-
Notifications
You must be signed in to change notification settings - Fork 34
stat
can result in unexpected runtime failures
#27
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
Comments
😱 this definitely shouldn't happen. Perhaps we incorrectly assumed the error would be thrown immediately if |
It seems to work as intended in node: > try {
... fs.statSync('./something');
... } catch (e) {
... console.log(e);
... }
{ [Error: ENOENT: no such file or directory, stat './something']
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: './something' } |
Fixed by b1a99f8, released in 0.9.3. Thanks for the report! :) |
Oops, I meant v0.10.1. I really need to get on and implement |
This is a failing example that's close to what I was using.
I'm not sure if the problem is with
stat
orcatchException
, but essentially this is the problem:You can use
catchException
to discharge anEXCEPTION
assumption from your program. Great! If we use enoughcatchException
s, the compiler tells us (assuming everything was well-typed) that our program won't have any uncaught exceptions at runtime.Except it does.
catchException
doesn't ... catch the exception ... when usingstat
on a path that doesn't exist.This threw me for a loop since I was assuming that uncaught runtime exceptions wouldn't happen.
The text was updated successfully, but these errors were encountered: