Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I compile from ECMAScript 4 to JS, and what I do is create a separate mapping file, where line/char pos for every token in the generated file is mapped to file/line/char in the source.

When the JS engine throws a runtime error it typically (depending on the engine) includes line/char pos for the point of error. A wrapper then extract line/char from the error message, finds the corresponding position in the original source, and displays that also. This greatly helps debugging runtime errors.

It is not perfect, since some engines (e.g. Rhino) doesn't include position for runtime errors.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: