-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Add .flag to EACCES errors from the fs module. #7796
Comments
Do u want to have the file access flags(like r w ) in the error object?? |
Basically. Functions like This would allow an error handler further up the stack to identify the difference between the "You do not have permission to read " and "You do not have permission to write ". |
I think this feature is not added to the core module because it affects the performance of the entire system since on each error all the permissions must be obtained. But we can have some middleware like thing for our own purpose like this: https://gist.github.com/arjunrp/6169b4d3d18b06007a10 |
Those aren't the flags I want. I want the flags passed to fs.open/etc... simple 'r', 'w', 'a', 'r+', etc... not something that requires a full stat. |
I'll happily entertain a PR. :) |
I'll happily work on this and would like to use the opportunity to understand the node.js core a little better. If someone could point out some details about the Could someone point out where the code for the |
Never-mind, I've found it. |
@yamadapc ... any updates on this? |
fs passes errors that are annotated with
.code = 'EACCES'
and.path
when a file cannot be read or written, it would be useful if the error also had a.flag
matching the.flag
/flags
that the file was attempted to be opened with.The text was updated successfully, but these errors were encountered: