-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add missing File::NotFoundError
exception documentation for File.open
#15826
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Johannes Müller <[email protected]>
Co-authored-by: Johannes Müller <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language suggestions
# | ||
# ``` | ||
# File.write("bar", "foo") | ||
# File.read("bar") # => "foo" | ||
# | ||
# File.read("notexist") # raises File::NotFoundError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# File.read("notexist") # raises File::NotFoundError | |
# File.read("non-existent-file") # raises File::NotFoundError |
@@ -524,10 +524,14 @@ class File < IO::FileDescriptor | |||
end | |||
|
|||
# Returns the content of *filename* as a string. | |||
# | |||
# Raises `File::NotFoundError` if the file at filename does not exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be more accurate to say something around the lines of?
Raises
File::Error
if the file cannot be accessed for whatever reason.
I think this is missing from the documentation. The PR is self explanatory (I believe)