I am executing js which is stored as a string inside the db via:
let myScript = ` await Some()
lines()
of()
js()`
let result
try{
result = await Object.getPrototypeOf(async function() {}).constructor(`return (async () => { ${myScript} })()`)()
} catch(e){
result = 'Error occurred: '+e.message + ' stack: ' + e.stack
}
The problem is: The line numbers of e.stack are not correct. I think it's somehow also counting line numbers of the contextual code. For some js strings, I don't even get a stack.
Anyone knows what the problem is?