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

Throwing too many exceptions on windows #12

Open
BurtHarris opened this issue Jun 4, 2017 · 1 comment
Open

Throwing too many exceptions on windows #12

BurtHarris opened this issue Jun 4, 2017 · 1 comment

Comments

@BurtHarris
Copy link

BurtHarris commented Jun 4, 2017

Using fs.stat or fs.statSync on windows ends up throwing lots of exceptions.

For example (one of hundreds generated by running a gulp command.

Exception has occurred: Error
Error: ENOENT: no such file or directory, stat 'c:\code\antlr4ts\npm.COM'
at Object.fs.statSync (fs.js:940:11)
at Function.sync (c:\code\antlr4ts\node_modules\isexe\windows.js:41:23)
at Function.sync (c:\code\antlr4ts\node_modules\isexe\index.js:49:17)
at Function.whichSync [as sync] (c:\code\antlr4ts\node_modules\which\which.js:117:20)
at npmPath (c:\code\antlr4ts\node_modules\global-prefix\index.js:67:45)
at Object.<anonymous> (c:\code\antlr4ts\node_modules\global-prefix\index.js:30:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
@Gudahtt
Copy link

Gudahtt commented Aug 2, 2018

That error indicates that the path does not exist. Throwing an error makes sense in that case.

The ignoreErrors option might be what you're looking for. This will test whether or not a file is executable, but return false if any error is encountered. This is useful for files that might not exist. There is an example of this in the README.

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

Successfully merging a pull request may close this issue.

2 participants