-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Errors during model hooks should emit to Ember.onerror #18533
Comments
The final error handling after
ember.js/packages/@ember/-internals/routing/lib/system/router.ts Lines 1601 to 1616 in 1b0c903
@rwjblue are you suggesting the error should be thrown in the case that it's handled, but the action that handled the error specified to bubble it up? |
hi @rwjblue , i have other question about onerror: when use async and catch a reject promise(rsvp, not native), always an error in console. https://ember-twiddle.com/8c7e71eeab8de3ca2a48345bc1058eb9?openFiles=routes.application%5C.js%2C in ember, if rsvp Promise has no catch handler, it look has a default handler in development ? i have to use |
@houfeng0923 - emberjs/ember-qunit#592 is a discussion about using native promises for these kinds of things |
@rwjblue was the original issue resolved? I might be doing something wrong, but I'm still seeing the error in the logs of my test suite 🤔 |
Currently, when a model hook rejects we bubble up the route hierarchy looking for any route that implements an
error
action. If we get to the top (above application route) we have some default behavior for theerror
action:ember.js/packages/@ember/-internals/routing/lib/system/router.ts
Lines 1232 to 1263 in 1b0c903
Which invokes
logError
, defined here:ember.js/packages/@ember/-internals/routing/lib/system/router.ts
Lines 1296 to 1323 in 1b0c903
As you can see,
logError
is a small layer on top ofconsole.error
. Unfortunately, this means that any errors during model hooks will not be sent toEmber.onerror
(unless you also implementerror
on your application route).We should fix this by checking if there is an
Ember.onerror
and invoking it with the error, falling back tologError
.The text was updated successfully, but these errors were encountered: