-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
fs: improve argument handling for ReadStream #19898
Closed
+96
−38
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e507f93
fs: improve argument handling for ReadStream
ryzokuken 30c285f
test,fs: update tests for improvements in ReadStream
ryzokuken 915d77c
Remove inconsistency
ryzokuken 17d6d55
Separate testing for start and end
ryzokuken 36574f4
Remove invalid check
ryzokuken e4415d5
Address comments regarding handling undefined
ryzokuken b946616
Refactor conditions
ryzokuken d00b46a
fs,doc: add documentation regarding changes to createReadStream
ryzokuken 93b0915
Add a changes block and move new documentation towards the end
ryzokuken 5d03199
Replace version by REPLACEME
ryzokuken 047529b
Minimize comments and documentation
ryzokuken a90457b
Address nit by adding parens
ryzokuken c3be59a
Resolve merge conflict
ryzokuken 41b3a2e
Thow RangeError on fractional values
ryzokuken 3530baa
Cleanup fs.md
ryzokuken 4863dba
Fix error
ryzokuken 1cf1814
Fix failures
ryzokuken 2c35628
Address nit
ryzokuken a24f115
Use isSafeInteger over isInteger
ryzokuken 0368397
Change error message
ryzokuken b6fa515
Improve error handling
ryzokuken 7bda63c
Refactor fs tests for brevity
ryzokuken c34ba43
Address nits
ryzokuken 30e36c2
Update RangeError error message
ryzokuken 9af225c
Update RangeError error message v2
ryzokuken c76e75a
Fix lint errors
ryzokuken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Refactor conditions
- Loading branch information
commit b9466160e870d215dd1b14392e636bf4bdc1d7cc
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looking at this again I would also change this to:
This ends up as:
The value of "start" is out of range. It must be <= ${this.end}. Received ${this.start}
instead of:
The value of "start" is out of range. It must be <= "end". Received {start: ${this.start}, end: ${this.end}}
It just seems better to read for me. It is also the way how it is done in e.g. the
buffer
module.But that is just a suggestion.
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.
Hmm, I'm not as inclined regarding this one.
Let's assume that the passed value of
end
is 4, andstart
is 6. The error message would be:The value of "start" is out of range. It must be <= 4. Received 6
.I bet there would be a section of developers, already coping with a huge language barrier, who would might to the conclusion that there's some magic value (4 in this case) which "start" needs to be smaller than.
What about:
The value of "start" is out of range. It must be <= "end" (here: 4). Received 6
instead?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.
👍 that works as well.