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
I am using Function to parse and eval some code in the browser. I would like to use StackTraceJS to show errors to my users in the code editor. My code is minified using Webpack/Uglify, but user code is not. User code is executed in a sandboxed iframe.
Expected Behavior
I expect that StackFrameJS should parse "anonymous" errors correctly.
Current Behavior
StackFrameJS does not parse anonymous errors like below, nor return the correct line number.
Sample User Code (should throw an error):
My code is executed like this
let runFunction = function (p) {
let f = null;
try {
f = Function("p", code)
f(p);
} catch (error) {
StackTrace.fromError(error).then(sr => {
window.parent.postMessage({sr, type: "err"}, "*");
})
}
}
// call runFunction
runFunction(...);
The stack trace looks like this (in Chrome)
ReferenceError: hi is not defined
at eval (eval at runFunction (http://localhost:8080/packs/iframe.js:5669:21), <anonymous>:4:9)
at runFunction (http://localhost:8080/packs/iframe.js:5670:17)
at e.Sketch.sketch.attachFunction (http://localhost:8080/packs/iframe.js:5722:17)
at e.Sketch.attach (eval at webpackJsonp.679.module.exports (http://localhost:8080/packs/iframe.js:11868:8), <anonymous>:43:267)
at Ir (eval at webpackJsonp.679.module.exports (http://localhost:8080/packs/iframe.js:11868:8), <anonymous>:1417:89)
at eval (eval at webpackJsonp.679.module.exports (http://localhost:8080/packs/iframe.js:11868:8), <anonymous>:1415:106)"
The parsed stack trace looks like this (first line)
Steps to Reproduce (for bugs)
Context
I am trying to use StackTrace to parse and show JS errors to a user in a browser editor (Monaco)
Your Environment
stacktrace.js version: 2.0
Browser Name and version: Chrome 58
Operating System and version (desktop or mobile): OS X Sierra 10.12.5
Possible Solution
Suggest improving the parser to handle nested / anonymous stack traces
@tarr11 commented on Mon Jun 12 2017
I am using
Function
to parse and eval some code in the browser. I would like to use StackTraceJS to show errors to my users in the code editor. My code is minified using Webpack/Uglify, but user code is not. User code is executed in a sandboxed iframe.Expected Behavior
I expect that StackFrameJS should parse "anonymous" errors correctly.
Current Behavior
StackFrameJS does not parse anonymous errors like below, nor return the correct line number.
Sample User Code (should throw an error):
My code is executed like this
The stack trace looks like this (in Chrome)
The parsed stack trace looks like this (first line)
Steps to Reproduce (for bugs)
Context
I am trying to use StackTrace to parse and show JS errors to a user in a browser editor (Monaco)
Your Environment
Possible Solution
Suggest improving the parser to handle nested / anonymous stack traces
@eriwen commented on Sat Aug 12 2017
Thanks for the issue. Error parsing is done in
error-stack-parser
, so I'm moving the issue to that project.The text was updated successfully, but these errors were encountered: