-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
await/then blocks don't allow errors (from promise) to bubble up #5129
Comments
what I have to do is:
Do you think that we can have something nicer to bubble the error up? |
I haven't tried this, but if this were as simple as making the error handler here re-reject with the error when there's no |
Here's one workaround: let userIdPromise = fetchCurrentUserId()
userIdPromise.catch(() => { throw e; }); The 2nd line creates a new promise that has the catch handler, but userIdPromise still refers to the original promise, and so the That said, you would have to do this for every promise so it's not very convenient. I think the approach suggested by @Conduitry is the proper solution. |
I have raised #5149 as per @Conduitry 's suggestion. |
In 3.25.0, |
I have a global error handler for uncaught promise errors, that will send promise errors to my server. This code is in the entry file
main.js
:Problem is that as soon as I use
await/then
blocks, the errors can't bubble up:The text was updated successfully, but these errors were encountered: