CrabDude / trycatch

An asynchronous domain-based exception handler with long stack traces for node.js
MIT License
246 stars 17 forks source link

CoffeeScript line numbers doesn't match 'trycatch' stack trace #40

Closed lesmo closed 9 years ago

lesmo commented 9 years ago

When running CoffeeScript files directly from the code, via require('coffee-script').register(); for example, Stack Traces are generated incorrectly by trycatch module; for example, line number 117 is shown in the trace, but it's really line 84 in the CoffeeScript file.

When running CoffeeScript files without using trycatch module, line numbers are shown correctly in the "normal" Stack Trace generated when an Error is thrown.

I'm not sure how CoffeeScript achieves this "mapping" of Stack Traces when compiling on the fly, so I can't provide much help there (I might try to later).

CrabDude commented 9 years ago

Will take a look. The mapping is done via sourcemaps, but if IIRC that's typically done before trycatch receives the error. This works correctly with traceur, but I'll figure out why it's failing with CoffeeScript.

CrabDude commented 9 years ago

Looks like source-map support is provided by the transpiler / runtime, and is unrelated to trycatch (probably). There's also the possibility that the recent commit to switch to using the native StackFrame.toString() instead of an included one, may have automatically fixed the issue.