dodona-edu / universal-judge

Universal judge for educational software testing
https://docs.dodona.be/en/tested
MIT License
9 stars 5 forks source link

Improve JavaScript stacktraces #359

Closed niknetniko closed 1 year ago

niknetniko commented 1 year ago

Fixes #346.

Before:

Traceback:AssertionError [ERR_ASSERTION]: ongeldig bericht
    at <code>:86:13
<code>:98
    at <code>:98:18

After:

Traceback:AssertionError [ERR_ASSERTION]: ongeldig bericht
    at bigram2letter (<code>:86:13)
    at <code>:98:32
    at Array.map (<anonymous>)
    at Codeersleutel.decodeer (<code>:98:18)
pdawyndt commented 1 year ago

@niknetniko Furthering on this: I try to understand the new stack trace for this example, but what would the <anonymous> in at Array.map (<anonymous>) mean? Is this a reference to the anonymous function that is passed on line 98, hence also the lack of a function name in the third line of the stack track (at <code>:98:32)?

niknetniko commented 1 year ago

what would the <anonymous> in at Array.map (<anonymous>) mean? Is this a reference to the anonymous function on that is passed on line 98, hence also the lack of a function name in the third line of the stack track (at <code>:98:32)?

I would assume it is indeed due to the map, as those parts are from the original stack trace we receive from NodeJS. For reference, this is the "raw" stack trace for this example:

AssertionError [ERR_ASSERTION]: ongeldig bericht
    at bigram2letter (/home/niko/Ontwikkeling/universal-judge/workdir/execution00/submission.js:86:13)
    at /home/niko/Ontwikkeling/universal-judge/workdir/execution00/submission.js:98:32
    at Array.map (<anonymous>)
    at Codeersleutel.decodeer (/home/niko/Ontwikkeling/universal-judge/workdir/execution00/submission.js:98:18)
    at context0 (/home/niko/Ontwikkeling/universal-judge/workdir/execution00/execution00.js:78:31)
    at async /home/niko/Ontwikkeling/universal-judge/workdir/execution00/execution00.js:1515:13
bmesuere commented 1 year ago

This is "normal" for js traces which is why some style guides recommend always naming your inline functions.