-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: Flexible Error/Exception handling #5929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
|
||
// before each | ||
export function tearDown() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this is executed after each test. There is a setUp() function for before each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup - I want to cache the original ErrorHandler
once and clean-up after each test to make sure the test does not leak side effects
tests/app/trace/trace-error-tests.ts
Outdated
setErrorHandler({ | ||
handlerError(error) { | ||
called = true; | ||
TKUnit.assert(error instanceof Error, "trace.error() wrap string in error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if it's fine in this case, I think it's dangerous to use asserts in callbacks. It's better to cache the value and assert it after the assertion of the called
variable. In cases where the callbacks are async asserting in them breaks the tests.
tns-core-modules/trace/trace.d.ts
Outdated
@@ -63,6 +63,11 @@ export function isCategorySet(category: string): boolean; | |||
*/ | |||
export function write(message: any, category: string, type?: number); | |||
|
|||
/** | |||
* Passes an error ot the registered ErrorHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo - "ot" -> "to"
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Implements #5914