Skip to content

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

Merged
merged 5 commits into from
Jun 18, 2018
Merged

feat: Flexible Error/Exception handling #5929

merged 5 commits into from
Jun 18, 2018

Conversation

vakrilov
Copy link
Contributor

@vakrilov vakrilov commented Jun 8, 2018

Implements #5914

@ghost ghost assigned vakrilov Jun 8, 2018
@ghost ghost added the in progress label Jun 8, 2018
@ns-bot ns-bot added the cla: yes label Jun 8, 2018
@vakrilov vakrilov requested a review from MartoYankov June 13, 2018 05:59
}

// before each
export function tearDown() {
Copy link
Contributor

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.

Copy link
Contributor Author

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

setErrorHandler({
handlerError(error) {
called = true;
TKUnit.assert(error instanceof Error, "trace.error() wrap string in error")
Copy link
Contributor

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.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo - "ot" -> "to"

@ghost ghost assigned vchimev Jun 18, 2018
@vakrilov vakrilov merged commit 3dc3a41 into master Jun 18, 2018
@ghost ghost removed the in progress label Jun 18, 2018
@vakrilov vakrilov deleted the error-trace branch June 18, 2018 13:37
@lock
Copy link

lock bot commented Aug 26, 2019

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.

@lock lock bot locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants