Merge pull request #1274 from Mikunj/better-error

Improve unhandled promise error logging
This commit is contained in:
Mikunj Varsani 2020-07-20 12:32:02 +10:00 committed by GitHub
commit 8d6b2e7c85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,7 +136,7 @@ window.onerror = (message, script, line, col, error) => {
};
window.addEventListener('unhandledrejection', rejectionEvent => {
window.log.error(
`Top-level unhandled promise rejection: ${rejectionEvent.reason}`
);
const error = rejectionEvent.reason;
const errorInfo = error && error.stack ? error.stack : JSON.stringify(error);
window.log.error(`Top-level unhandled promise rejection: ${errorInfo}`);
});