Skip to content
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

suggestion for verbose error reporting as per #721 #722

Closed
wants to merge 1 commit into from

Conversation

amir-arad
Copy link

I didn't find the right place to add tests for the new field in spy error message, would love a point to the right direction :)

time report in npm run perf seems the same with +-10% range of error , also this change should only slightly affect behavior of systems already in error mode (as the catch blocks were added to already non optimizable functions)

@amir-arad
Copy link
Author

fixes #721

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.002%) to 95.715% when pulling 17c5f9b on amir-arad:add-cause-error into 6ed404b on mobxjs:master.

} catch(e){
hasException = true;
handleExceptionInDerivation(derivation, e);
throw e;
Copy link
Member

@mweststrate mweststrate Dec 27, 2016

Choose a reason for hiding this comment

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

The problem with this change is this changes the stack trace of the exception to this line. MobX had something similar in the past, but since the original stack is lost with a catch / error, people will blame MobX for the exception, although it originated in userland, which results in a plethorea of issues in the MobX issue tracker. Sadly this cannot be fixed really nicely in Javascript as far as I know 😢

Copy link

Choose a reason for hiding this comment

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

The stack trace is generated when new Error is called, so rethrowing the same error object shouldn't change the stack (unless handleExceptionInDerivation mutates the error object)

Copy link
Author

Choose a reason for hiding this comment

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

what @spion said ...
what do you think about a test to assert the original stack trace?

Copy link
Member

Choose a reason for hiding this comment

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

See: #731

@mweststrate
Copy link
Member

Merged into, and closed in favor of #736. Thanks for stirring up the discussion!

@mweststrate mweststrate closed this Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants