ysmood / yaku

A lightweight promise library
https://tonicdev.com/ysmood/yaku
MIT License
291 stars 28 forks source link

Can't register global unhandled rejection #44

Closed derobo closed 7 years ago

derobo commented 7 years ago

i try to add a handler for all unhandled rejection: window.onunhandledrejection = ({ reason, promise }) => { console.log('help');}; Promise.reject(new Error("ERR"));

The only output i can see is the default 'Potentially unhandled rejection [1] Error: ERR'. Is it a bug or am i using it wrong?

ysmood commented 7 years ago

Are you sure you are using Yaku? If you use the native Promise, you should get what you seen.

Maybe you need something like this:

window.Promise = require('yaku')

By default yaku won't pollute your global environment.