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 filename to transform error #10511
Add filename to transform error #10511
Conversation
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.
awesome!!
aside: maybe later we can think about normalizing error messages or moving into util (are there other scenarios where no filename is thrown? or maybe relating to the config used)
I think it is still slightly early to extract the error messages processing into separate utils. I would suggest refactoring when we are working on the debug mode error message. |
Same haha! I think not being to know the file where the error is happening to due an internal error (not syntax error) would be pretty bad on our part so best to make filing an issue easy! 🙌 |
Previous art: In the parsing stage babel-core will add filename to the error message
babel/packages/babel-core/src/transformation/normalize-file.js
Line 145 in 94fcabc
In this PR we add
filename
to the error message to both transforming phrase and generating phrase. It should help developer debug which file actually causes babel transformer/generator to throw.