alt
alt copied to clipboard
Unhandled promise reject with with async datasource
Using the datasource decoration on the store and when the error handler is called, it will callback through the action to the Store, but will also throw Unhandled promise rejection .... Why is this? are we supposed to catch the thrown exception here?
I'm not sure, can you post a failing test case?
because you re throw the reject, one will need to catch it in the call to the remote call. seems a bit inconvenient, since you also have the error handling action. perhaps it should be up the implementor to throw in the error handler vs. always throwing in the remote action?
fetch(key) {
this.getInstance().performFetch(key).catch((err) => {
// need to catch here since the rejection is re-thrown
console.error(err)
});
}
fetchError(err) {
// this is the rejection handler, we could choose to re-throw here instead?
}
The reason I'm throwing there is so that failed actions are marked as rejected.
ahh, are you handling that exceptions somewhere?
On Wed, Aug 26, 2015 at 4:48 PM Josh Perez [email protected] wrote:
The reason I'm throwing there is so that failed actions are marked as rejected.
— Reply to this email directly or view it on GitHub https://github.com/goatslacker/alt/issues/447#issuecomment-135207117.
Well for Render for example it's needed so you can fail the entire Promise.all call
Is there any progress on this to provide some way to catch those rejections so they don't show up as unhandled?
@reauv you can catch it when you call it https://github.com/goatslacker/alt/issues/447#issuecomment-128798413 but that's the only way I've found. a bit cumbersome.
+1 It's impossible to handle these rejections :(
+1 It's impossible to handle this situation :(
+1
+1
Thanks for the report, @wprater! We are running into this problem as well.
Does anyone know if Is this resolved in alt 0.18.x?
AFAIK this is not resolved in 0.18.x, I'm running 0.18.2 and it has this issue.
Does anyone have a workaround for this where we can use the error handler we've defined but not have an uncaught promise?