Skip to content

Commit

Permalink
handle throw of non-Errors gracefully (#3492)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Oct 16, 2019
1 parent 7b5350b commit b571619
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/ufuzz.js
Expand Up @@ -959,14 +959,19 @@ if (require.main !== module) {
return;
}

function writeln(stream, msg) {
if (typeof msg != "undefined") {
stream.write(typeof msg == "string" ? msg : msg.stack || "" + msg);
}
stream.write("\n");
}

function println(msg) {
if (typeof msg != "undefined") process.stdout.write(typeof msg == "string" ? msg : msg.stack);
process.stdout.write("\n");
writeln(process.stdout, msg);
}

function errorln(msg) {
if (typeof msg != "undefined") process.stderr.write(typeof msg == "string" ? msg : msg.stack);
process.stderr.write("\n");
writeln(process.stderr, msg);
}

function try_beautify(code, toplevel, result, printfn) {
Expand Down

0 comments on commit b571619

Please sign in to comment.