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

pull/4519/head
Richard Hansen 2020-11-17 01:03:19 -05:00 committed by John McLear
parent c845d985e0
commit 07bcbbd404
1 changed files with 4 additions and 1 deletions

View File

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