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
Chore: improve crash reporting (fixes #11304) #11463
Conversation
Add line number to the output in the event of a rule crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
debug("An error occurred while traversing"); | ||
debug("Filename:", options.filename); | ||
if (err.currentNode) { | ||
const { line } = err.currentNode.loc.start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get column information here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could. The reason I didn't include it is because it's even less accurate than the line number - it won't always point exactly to the spot that caused the crash. Even the line number won't always do that, depending on how the rule is implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for improving this!
Add source file name and line number to the output in the event of a rule crash
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
See #11304.
What changes did you make? (Give an overview)
Added file name and line information to the error being thrown. This will get output independent of the verbosity setting.
Is there anything you'd like reviewers to focus on?
Not sure about the exact output format, made a best guess.