-
Notifications
You must be signed in to change notification settings - Fork 773
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
Uncatchable errors when there are invalid arguments #227
Comments
So you're saying, you don't ever see "Errr"? |
yes, try this code in pure node console (i tried it in node 5.6). In real application this will throw and ends brutally app. TypeError: dest path must be a string |
This is at https://github.com/jprichardson/node-fs-extra/blob/master/lib/mkdirs/mkdirs.js#L32.
Passing CC: @jprichardson |
👍 |
fs throws a TypeError if path is not a string. However in basic functionality you can easly catch this error!
code crash on fs.link in move/index.js. If you call wrap each try{} catch{} atomic async method (like fs.link) you will not given any of uncachted error., you can handle error it in async pattern (by callback)!. If you will not provide this protection, on low level, there is no chance to catch it on high level Of course passing explicit null doesn't have sense, and i agree i can put any validation before run command. But this is not point. For me basic library which may crash whole application without chance to catch error, on such trivial level... It is something wrong |
I would tend to argue that in this case you should still type-check it yourself. |
I think whole fs library throw only catchable errors. |
@enneid interested in submitting a PR? |
I can't say when I may make pr , but ok |
Try this code:
it will crash without chance to catch error.
The text was updated successfully, but these errors were encountered: