We've some user defined fields defining javascript functions and would like to show the user the position ( line, column ) when an error is thrown. For example :
userFunc = new Function('context', '{ let a = 0; \n context.missingFunction(); return 2; }');
When evaluating userFunc
userFunc({});
an exception is thrown, that looks like :
context.missingMeethod is not a function
Is there a library to retrieve the position of the error in all modern browsers (e.g. : line 2, column 12 )
error-stack-parser library (from StacktraceJS) is not retrieving the information. In Chrome the stacktrace looks like (the position is in anonymous):
TypeError: context.missingMeethod is not a function
at eval (eval at <anonymous> (http://localhost:3000/icCube/reporting/static/js/main.chunk.js:28541:66), <anonymous>:2:12)