pad: Include the stack in the data sent to `/jserror`
parent
c845d985e0
commit
07bcbbd404
|
@ -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,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue