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
Fix custom syntax require error handling #5635
Conversation
0f880cf
to
086485b
Compare
MODULE_NOT_FOUND
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!
|
Just wondering, couldn't we start using the optional chaining operator in cases like this? Like |
I don't think optional chaining is available in node 12.20. (see node green and mdn). If it is, though, we can adopt it. |
Ah, true, I guess one thing to do when Node.js 12 support is dropped :) |
@jeddy3 A possible improvement to this error message would be to include the full error message and require stack in the output, instead of assuming that the module that cannot be found is the value in
|
Sounds good. Pull request welcome. |
Node.js
require()
may cause other errors thanMODULE_NOT_FOUND
. This change aims to throw such errors.See also: https://nodejs.org/api/errors.html#errors_module_not_found