Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.63 KB

promise.onpossiblyunhandledrejection.md

File metadata and controls

42 lines (32 loc) · 1.63 KB
layout id title
api
promise.onpossiblyunhandledrejection
Promise.onPossiblyUnhandledRejection

← Back To API Reference

##Promise.onPossiblyUnhandledRejection
Promise.onPossiblyUnhandledRejection(function(any error, Promise promise) handler) -> undefined

Note: this hook is specific to the bluebird instance it's called on, application developers should use global rejection events

Add handler as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or console.error in browsers.

Promise.onPossiblyUnhandledRejection(function(e, promise) {
    throw e;
});

Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections.

<script type="text/javascript"> var disqus_title = "Promise.onPossiblyUnhandledRejection"; var disqus_shortname = "bluebirdjs"; var disqus_identifier = "disqus-id-promise.onpossiblyunhandledrejection";
(function() {
    var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
    dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
    (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script> Please enable JavaScript to view the comments powered by Disqus.