Skip to content

Commit

Permalink
Always print some diagnostics to stderr on error
Browse files Browse the repository at this point in the history
Even if event.error is defined, the other props includes
valuable information
  • Loading branch information
fatso83 committed Sep 24, 2018
1 parent b5537a5 commit 88891f5
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/webworker/webworker-support-assessment.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,24 @@ if (typeof Worker !== "undefined") {
*/
function onError(ev) {
var error = ev.error;
var msg =
"An error happened at line " +
[ev.lineno, ev.colno].join(":") +
" in file " +
ev.filename +
": " +
ev.message;

if (!error) {
var msg =
"An error happened at line " +
[ev.lineno, ev.colno].join(":") +
" in file " +
ev.filename +
": " +
ev.message;
error = new Error(msg);
}

// `ev.error` might be defined, but still might include
// very little information, which is why we want to
// include as much information as we possibly can

console.error(msg); // eslint-disable-line no-console

done(error);
}

Expand Down

0 comments on commit 88891f5

Please sign in to comment.