-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Observer throws false MobXCaughtException on any exceptions thrown within its scope #905
Comments
You can catch MobXCaughtException and read its .exception field |
I can't imagine wrapping every Observer into try-catch. |
@subzero911 disableErrorBoundaries: When By default, MobX will catch and re-throw exceptions happening in your code to make sure that a reaction in one exception does not prevent the scheduled execution of other, possibly unrelated, reactions. This means exceptions are not propagated back to the original causing code and therefore you won't be able to catch them using try/catch. By disabling error boundaries, exceptions can escape derivations. This might ease debugging, but might leave MobX and by extension your application in an unrecoverable broken state. https://mobx.js.org/configuration.html#disableerrorboundaries-boolean |
Example:
Here, the error reason is a bad GoRouter configuration, but MobX wraps it into MobXCaughtException.
This makes debugging difficult.
The text was updated successfully, but these errors were encountered: