javascript - Bluebirdjs swallowing errors when binded to 'this' -
taking following example:
window.addeventlistener('unhandledrejection', function(e) { console.error(e); }); var p = new promise(function(resolve, reject) { console.log('start'); resolve(); }); p.bind(this).then(function() { console.log('then'); //this.callfunction here throw new error('err'); });
i expect error caught in unhandledrejection event listener , error outputted console. works fine when .bind(this)
not in code error seems swallowed when used. explanation why case appreciated. thanks.
Comments
Post a Comment