You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zone.js promises returning Unhandled Promise Rejection error even with catch blocks #31680
I am working on an angular environment with zone.js so all the native es6 promises have been over-written by zone-aware promises. I have 2 functions called save() and onSaveCb()
save() calls a function called validate() which gets the error-codes of any of the saved objects already present in the file so it is done in sync.
if hasError() returns true we return Promise.reject() from save() otherwise we send a save request to the backend.
Now, onSaveCb() function is an async/await function which has a try-catch block around save().
Problem:
When Promise is rejected from save() function, I see console log error:
@Kanti, sure, I have fixed this one, but it break some cases inside Google, so I am working on to provide an option flag to enable/disable this uncaught promise error feature of zone.js.
Reacted by Matthias Vogel, ilhan orhan, Sergey Gavrilov, James Bromwell and Tobias Wittwer
Is there any update on this issue? I'm seeing warnings about promises I actually catch as well (using promise.then(x => { }, err => { })). I don't want to totally disable Zone's uncaught promise detection feature -- it would be great if it worked! -- but I'd like it to stop spuriously telling me I didn't catch something that is in fact caught.
Reacted by Tobias Wittwer, Bob Chesley and Daniel Jackson
Activity
JiaLiPassion commentedon Jun 19, 2019
@utsavkapoor thanks for posting the issue, I will check it.
JiaLiPassion commentedon Jul 19, 2019
@utsavkapoor, could you provide a sample repo to reproduce, thanks!
Kanti commentedon Sep 3, 2019
copy this inside an empty chrome window.
or open it here: https://codepen.io/kanti/pen/yLBPLGB?editors=0011
or here: https://jsfiddle.net/iKanti/b67zu4pq/1/
Without zone.js it doesn't throw an Unhandled Promise rejection.
But with zone.js it throws an Unhandled Promise rejection.
JiaLiPassion commentedon Sep 5, 2019
@Kanti, sure, I have fixed this one, but it break some cases inside
Google, so I am working on to provide anoption flagto enable/disable thisuncaught promise errorfeature ofzone.js.thw0rted commentedon Jan 29, 2020
Is there any update on this issue? I'm seeing warnings about promises I actually catch as well (using
promise.then(x => { }, err => { })). I don't want to totally disable Zone's uncaught promise detection feature -- it would be great if it worked! -- but I'd like it to stop spuriously telling me I didn't catch something that is in fact caught.JiaLiPassion commentedon May 28, 2020
this issue should be fixed by this PR #35873
angular-automatic-lock-bot commentedon Jun 28, 2020
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.