patriksimek/vm2

Add support for "correct" stack traces for errors in the sandbox

Open

#87 ouverte le 4 août 2017

Voir sur GitHub
 (13 commentaires) (8 réactions) (0 assignés)JavaScript (285 forks)batch import
feature requesthelp wanted

Métriques du dépôt

Stars
 (3 798 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

It would be nice if vm2 could display "correct" stack traces when an error is thrown from the sandbox.

For instance, this is what is currently displayed:

/home/user/box-js/node_modules/vm2/lib/main.js:213
                        throw this._internal.Decontextify.value(e);
                        ^

Error: foobar
    at Object.log (/home/user/box-js/analyze.js:248:10)
    at Object.apply (/home/user/box-js/node_modules/vm2/lib/contextify.js:288:34)
    at vm.js:491:9
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at VM.run (/home/user/box-js/node_modules/vm2/lib/main.js:207:72)
    at Object.<anonymous> (/home/user/box-js/analyze.js:383:5)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)

Is there a way to figure out which line (in the sandboxed code) was responsible for calling the function that threw the error?

Guide contributeur