You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
If there's an exception on the server, stacktraces should be printed with line numbers corresponding to our actual TypeScript source so that we can navigate the code and figure out what happened.
Actual behavior:
Line numbers currently correspond to the compiled JS, making it difficult to interpret stack traces.
Additional context:
This came up in #1380, and complicated sorting out a solution.
metasoarous
changed the title
Server stacktrace line numbers should correspond to TS source
Fix TypeScript linenumbers on server stacktraces
Apr 19, 2022
I took a look at your suggested solution metasoarous and have it working on my end. However, the module only works with Error objects as it manipulates the stack property. Since primitive exceptions (throwing strings, numbers etc.) do not have a stack property they will not be correctly identified in stack traces. I noticed there are quite a few strings thrown in the .ts files. Would another solution be preferable?
I would support us rewriting our throws to use error objects if that gets us around this problem. We already have an issue up tracking overall improved logging (see #1379), and this would fit well with that.
Expected behavior:
If there's an exception on the server, stacktraces should be printed with line numbers corresponding to our actual TypeScript source so that we can navigate the code and figure out what happened.
Actual behavior:
Line numbers currently correspond to the compiled JS, making it difficult to interpret stack traces.
Additional context:
This came up in #1380, and complicated sorting out a solution.
Suggested solution:
It looks like there's a plugin for creating source mappings, the usage of which is described here:
https://stackoverflow.com/questions/50363449/how-to-get-error-information-relating-to-typescript-file-lines-number-in-node-js
The text was updated successfully, but these errors were encountered: