When my scala -js code throws an error, I would like to send a reasonable glass back to my server to put in the logs. By “smart stitch” I mean something that gives Scala methods, file names and line numbers, rather than the transmitted javascript code.
I achieved good results by getting the source map and using the Javascript source library ( https://github.com/mozilla/source-map ) to translate each stacktrace element from javascript to the corresponding Scala code.
My problem: I need a column number of javascript code that throws an error but doesn't see how to get it. Printing a StackTraceElement produces a result similar to
oat.browser.views.query.QueryRunView$.renderParamsTable$1(https:
I need “188” at the end of the line, but I don’t see how to get it except calling toString and parsing the result. Looking at the StackTraceElement code, the column number is a private variable in which there is no access to the API.
Is there any other approach to this that I completely ignore? Is there anything built into scala -js that converts a javascript stack into a Scala stacktrace?
source
share