In Node.js, when you throw an exception and don't catch it, by default you get a display like:
C:\tptp-parser\index.js:19
throw e
^
SyntaxError: Unknown language (33:7)
at err (C:\tptp-parser\index.js:14:10)
at Object.parse (C:\tptp-parser\index.js:354:5)
at read (C:\tptp-parser\tptp-parser.js:14:15)
at Object.<anonymous> (C:\tptp-parser\tptp-parser.js:37:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
The first three lines are the location in your source code where the exception was thrown from, then a message, then a stack trace. I know how to customise the message (as in the above example); is there a way to also customise the first three lines?
That is, I'm writing a parser, and it would be ideal if I could change the first three lines to show, not the line of code in the parser, but the line of text in the file being parsed. Is there a way to do that?
via rwallace
No comments:
Post a Comment