Merge pull request #4661 from yglukhov/js-uncaught-stacktrace

Uncaught exceptions in JS now always propagate with better stack trace. Fixed codegen bug.
This commit is contained in:
Andreas Rumpf 2016-08-29 11:52:41 +02:00 • committed by GitHub
commit 10ee254a50
6 changed files with 71 additions and 46 deletions

View file

@ -221,6 +221,7 @@ proc jsTests(r: var TResults, cat: Category, options: string) =
for testfile in ["exception/texceptions", "exception/texcpt1",
"exception/texcsub", "exception/tfinally",
"exception/tfinally2", "exception/tfinally3",
"exception/tunhandledexc",
"actiontable/tactiontable", "method/tmultim1",
"method/tmultim3", "method/tmultim4",
"varres/tvarres0", "varres/tvarres3", "varres/tvarres4",

View file

@ -334,6 +334,11 @@ proc testSpec(r: var TResults, test: TTest) =
let exeCmd = (if isJsTarget: nodejs & " " else: "") & exeFile
var (buf, exitCode) = execCmdEx(exeCmd, options = {poStdErrToStdOut})
# Treat all failure codes from nodejs as 1. Older versions of nodejs used
# to return other codes, but for us it is sufficient to know that it's not 0.
if exitCode != 0: exitCode = 1
let bufB = if expected.sortoutput: makeDeterministic(strip(buf.string))
else: strip(buf.string)
let expectedOut = strip(expected.outp)