Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stack trace to bin error output. #741

Closed
wants to merge 1 commit into from

Conversation

timoxley
Copy link
Contributor

On the command-line, it is currently rather difficult to discover where/why an error is being generated as the output error message does not include a trace trace. Perhaps this was included at some point in the past and has disappeared with security changes to the Error object. Current error messages can originate deep inside the module hierarchy and/or not be easily greppable due to generic/concatenated messages.

Example Output

Before

> ./bin/cmd.js -t ./test/bin_tr_error/tr.js ./test/bin_tr_error/main.js
Error: there was error
>

After

> ./bin/cmd.js -t ./test/bin_tr_error/tr.js ./test/bin_tr_error/main.js
Error: there was error
    at Stream.end (/Users/timoxley/Projects/libs/node-browserify/test/bin_tr_error/tr.js:9:28)
    at _end (/Users/timoxley/Projects/libs/node-browserify/node_modules/through/index.js:65:9)
    at Stream.stream.end (/Users/timoxley/Projects/libs/node-browserify/node_modules/through/index.js:74:5)
    at f (/Users/timoxley/Projects/libs/node-browserify/node_modules/module-deps/index.js:230:19)
    at makeTransform (/Users/timoxley/Projects/libs/node-browserify/node_modules/module-deps/index.js:296:20)
    at ap (/Users/timoxley/Projects/libs/node-browserify/node_modules/module-deps/index.js:215:13)
    at applyTransforms (/Users/timoxley/Projects/libs/node-browserify/node_modules/module-deps/index.js:232:11)
    at /Users/timoxley/Projects/libs/node-browserify/node_modules/module-deps/index.js:178:17
    at fs.js:266:14
    at Object.oncomplete (fs.js:107:15)
>

amended: fixed some 2 space indentation.

Currently very difficult to discover where an error is being generated
without a trace trace.
@weilu
Copy link

weilu commented May 3, 2014

+1. I recently encountered this problem.

@ghost
Copy link

ghost commented May 3, 2014

Thanks for the patch! Merged in 3.45.0.

Originally back before transforms I was thinking that truncated traces made sense because almost all the errors were thrown inside of AST parsing code due to errors in code that was being bundled, but now that transforms are more widespread it makes more sense to just show the complete stack traces.

@ghost ghost closed this May 3, 2014
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants