-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
utils: [Fix] report the error stack on a resolution error #599
Conversation
Fixes import-js#536. Resolve errors are most likely caused by invalid configuration, and the reason is easier to determine with the full details rather than just `err.message`. With this change, it reports something like: ``` import/no-unresolved: Resolve error: SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:387:25) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Module.require (module.js:367:17) at require (internal/module.js:16:19) at module.exports (/__censored__/webpack/configFactory.js:216:3) at configProdClient (/__censored__/webpack/configProdClient.js:5:36) at Object.<anonymous> (/__censored__/webpack/configForEslintImportResolver.js:1:126) ```
Ah, cool. Makes sense, though in retrospect I'm thinking maybe the stacktrace should be emitted by a What do you think? |
I think the stack for this specific error is meaningful at the exact place where the error has occurred, to be able to quickly fix the error without switching context. I use Atom Linter, so I expect all the error details in the linter error message which editor shows me. We could also log the error, but the core benefit is being able to see its cause quickly. |
Is this PR moving? It would really be helpful. |
@st-sloth Looks like the tests need to be updated to reflect the change. I'll have a look if time allows. |
Changed the logic slightly to only add stack to unknown errors (that do not originate from |
1 similar comment
Resolve error
report err.stack
Resolve errors are most likely caused by invalid configuration, and the reason is easier to determine with the full details rather than just
err.message
.See #536
With this change, it reports something like: