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

sync should rethrow if stat throws (but not ENOENT) #79

Closed
stefanpenner opened this issue Apr 28, 2015 · 1 comment
Closed

sync should rethrow if stat throws (but not ENOENT) #79

stefanpenner opened this issue Apr 28, 2015 · 1 comment

Comments

@stefanpenner
Copy link
Contributor

https://github.com/substack/node-resolve/blob/1.1.6/lib/sync.js#L9-L11

It is possible for fs.statSync to fail do for reasons other then ENOENT. As such, we should re-throw or we end up with an un-related error do to the stat object being missing: https://github.com/substack/node-resolve/blob/1.1.6/lib/sync.js#L1

note this would also fix the a-symmetry with async – which correctly handles the error https://github.com/substack/node-resolve/blob/1.1.6/lib/async.js#L23

an example would be: fs.statSync('\\\\some-unc-path\\folder name\\missing file') will throw unfortunately throw an UnknownError :(

stefanpenner added a commit to stefanpenner/node-resolve that referenced this issue Apr 28, 2015
@stefanpenner
Copy link
Contributor Author

A followup question should be, does this mysterious UnknownError also mean "ENOENT" and should actually throw the missing module error.

Should we dig into this further upstream? What should node do here.

@ljharb ljharb closed this as completed in 3325ec1 Dec 13, 2016
ljharb added a commit that referenced this issue Dec 14, 2016
 - [New] add missing core modules, and determine them dynamically by node version
 - [Fix] `resolve.sync` should re-throw non `ENOENT errors (#79)
 - [Fix] Create error outside process.nextTick (#103)
 - [Dev Deps] update `tape`; add `safe-publish-latest`
 - [Tests] test on every minor version of node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant