jaredhanson / jaredhanson/node-parent-require

Throws a missleading error a the module fails to load

Open
#3 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
34
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Currently this module swallows all errors when the trying to load a module.

I suggest adding this to the catch block:

```
if(ex.code !== 'MODULE_NOT_FOUND') {
throw ex;
}
```

This allows the module to still search up the stack, but if it finds a module and has a legitimate error loading the module you can still catch that error.

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the module-loading catch block in the node-parent-require code and trace how it searches parent modules. Preserve the search behavior for missing modules while ensuring legitimate errors from a found module are not swallowed. Verify both cases with the existing project tests, if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.