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

Import Errors Hidden by real-require Retry #156

Open
hhanesand opened this issue Jul 12, 2024 · 1 comment
Open

Import Errors Hidden by real-require Retry #156

hhanesand opened this issue Jul 12, 2024 · 1 comment

Comments

@hhanesand
Copy link

In the start function, the error.code === undefined condition in the path which leads to real-require can hide errors which are useful to throw. We had an issue in the file which was imported which resulted in a ReferenceError being thrown. This error has no code value, and therefore the start function tries to require the file. Since the file is a es module, it fails with the ERR_REQUIRE_ESM error. The only way to figure out the real error is to insert a console.log or try to load the module directly.

I am happy to submit a PR. Would one which removes this error.code === undefined condition be accepted? Any suggestions to what kinds of tests should be added?

@mcollina
Copy link
Member

Absolutely if you add some tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants