1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-11 16:18:10 +00:00

BF: remove onunhandledrejection but keep data-error

This commit is contained in:
Thomas Pronk 2021-06-14 22:48:37 +01:00
parent d613518ca6
commit a4b24145a8

View File

@ -728,7 +728,7 @@ export class PsychoJS
window.onerror = function (message, source, lineno, colno, error)
{
console.error(error);
// Log errors in data-error, for processing by WebDriverIO tests
document.body.setAttribute('data-error', JSON.stringify({
message: message,
source: source,
@ -736,22 +736,7 @@ export class PsychoJS
colno: colno,
error: error
}));
self._gui.dialog({"error": error});
return true;
};
window.onunhandledrejection = function (error)
{
console.error(error?.reason);
if (error?.reason?.stack === undefined) {
// No stack? Error thrown by PsychoJS; stringify whole error
document.body.setAttribute('data-error', JSON.stringify(error?.reason));
} else {
// Yes stack? Error thrown by JS; stringify stack
document.body.setAttribute('data-error', JSON.stringify(error?.reason?.stack));
}
self._gui.dialog({error: error?.reason});
return true;
};
}