Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: remove onunhandledrejection but keep data-error #399

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions src/core/PsychoJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,30 +728,15 @@ 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,
lineno: lineno,
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;
};
}
Expand Down