pad: Include the stack in the data sent to /jserror

This commit is contained in:
Richard Hansen 2020-11-17 01:03:19 -05:00 committed by John McLear
parent c845d985e0
commit 07bcbbd404

View file

@ -479,13 +479,15 @@ padutils.setupGlobalExceptionHandler = () => {
if (globalExceptionHandler == null) {
globalExceptionHandler = (e) => {
let type;
let err;
let msg, url, lineno;
if (e instanceof ErrorEvent) {
type = 'Uncaught exception';
err = e.error || {};
({message: msg, filename: url, lineno: linenumber} = e);
} else if (e instanceof PromiseRejectionEvent) {
type = 'Unhandled Promise rejection';
const err = e.reason || {};
err = e.reason || {};
({message: msg = 'unknown', fileName: url = 'unknown', lineNumber: linenumber = -1} = err);
} else {
throw new Error(`unknown event: ${e.toString()}`);
@ -534,6 +536,7 @@ padutils.setupGlobalExceptionHandler = () => {
source: url,
linenumber,
userAgent: navigator.userAgent,
stack: err.stack,
}),
});
};