Skip to content

Noder should preserve stack traces when re-throwing exceptions from loaded scripts #26

@PK1A

Description

@PK1A

As of today noder-js will catch and re-throw exceptions originating from loaded scripts. But when re-throwing in exception we are loosing the original stack trace which contains information paramount to the effective application debugging.

Consider this simple example:

which simply throws:

Uncaught TypeError: Cannot read property '+1:oid' of null

without giving me the line number / file name (at least in Chrome, it might be browser dependent). With a message as the only info it is really hard to debug effectively, especially bigger applications.

While what I would expect is this:

"TypeError: Cannot read property '+1:oid' of null
at Object.klass.createObjectObserver (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:3617:30)
at Object.klass.createExpressionObservers (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:3605:34)
at Object.klass.createNodeInstance (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:2074:25)
at Object.klass.createNodeInstance (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:2086:65)
at Object.klass.init (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:3559:45)
at Object.klass.$constructor (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:3524:26)
at Object.klass.process (http://hashspace.ariatemplates.com/dist/0.0.5-SNAPSHOT/hashspace-noder.js:5938:28)
at Object.exports.template.f as template
at Object.arguments.(anonymous function).res (eval at (http://noder-js.ariatemplates.com/dist/v1.6.0/noder.dev.js:1313:19), :12:16)
at Object.contextProto.moduleExecuteSync (http://noder-js.ariatemplates.com/dist/v1.6.0/noder.dev.js:1185:70)"

I'm painfully aware of the fact that exceptions / stack traces are in a lamentable state in JavaScript but IMO we need to improve the situation here as people might loose way to much time on debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions