Rejecting a promise throws "Uncaught (in promise)"
just like Amaya said, you must use catch
to catch the error, otherwise it will become a UnhandledPromiseRejection
, different promise
vender have different implementations to handle such kind of UnhandledPromiseRejection
, but in either way, it will just be thrown at some point, so zone.js
will throw the error in the next tick
.
And I see you have already used finally, if you use finally UnhandledPromiseRejection
should not be thrown, but you need to use zone.js 0.8.26
to support Promise.finally
, if the error still exists when you upgrade the zone.js
, please tell me or fire an issue in zone.js
repository, https://github.com/angular/zone.js/issues
You have to catch
it to prevent the error
modal.promise.then(hideFn, hideFn).catch((res) => {});