Fix logging of unhandled promise rejections

This commit is contained in:
Dan Stillman 2017-06-02 10:37:14 -04:00
parent 4b0e2a9554
commit 47f7f3a93f

View File

@ -16,13 +16,14 @@ Promise.onPossiblyUnhandledRejection((e, promise) => {
return; return;
} }
typeof Zotero !== 'undefined' && Zotero.debug('Possibly unhandled rejection:\n\n' dump('Possibly unhandled rejection:\n\n'
+ (e.message + (e.message
? e.message + "\n\n" + e.stack.split(/\n/) ? e.message + "\n\n" + e.stack.split(/\n/)
// Filter out internal Bluebird calls // Filter out internal Bluebird calls
.filter(line => !line.includes('bluebird')) .filter(line => !line.includes('bluebird'))
.join('\n') .join('\n')
: e), 1); : e)
+ '\n');
throw e; throw e;
}); });