fs: use assert in fsCall argument checking #38519
Closed
pd4d10 wants to merge 2 commits intonodejs:masterfrom
Closed
fs: use assert in fsCall argument checking #38519pd4d10 wants to merge 2 commits intonodejs:masterfrom
pd4d10 wants to merge 2 commits intonodejs:masterfrom
Conversation
Member
|
The throw can be triggered like this: import { open } from 'fs/promises'
const handle = await open(new URL(import.meta.url))
handle.read.call({}) |
Contributor
Contributor
Author
OK, get it. Also noticed that the One more question, what if we change all these prototype methods, such as |
Contributor
Author
Member
|
Alternatively this could be changed to an |
In the user perspective, it's not an arguemnt type error. Replace it with an `assert` expression.
Contributor
Author
+1. In the user perspective, it's not an argument type error. Replaced it with an |
aduh95
reviewed
May 6, 2021
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95
approved these changes
May 6, 2021
RaisinTen
approved these changes
May 6, 2021
Member
RaisinTen
left a comment
There was a problem hiding this comment.
Could you also update the PR title?
Contributor
Author
Updated |
Collaborator
jasnell
approved these changes
May 6, 2021
Member
|
Landed in 8231cc4 |
jasnell
pushed a commit
that referenced
this pull request
May 6, 2021
In the user perspective, it's not an arguemnt type error. Replace it with an `assert` expression. PR-URL: #38519 Refs: https://coverage.nodejs.org/coverage-68e6673224365120/lib/internal/fs/promises.js.html#L268 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
May 17, 2021
In the user perspective, it's not an arguemnt type error. Replace it with an `assert` expression. PR-URL: #38519 Refs: https://coverage.nodejs.org/coverage-68e6673224365120/lib/internal/fs/promises.js.html#L268 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It seems to be a piece of dead code and could be safely removed1. ThefsCallfunction is only used within theFileHandleprototype methods2. The second argument of every call isthis, which ensures it's an instance ofFileHandleUpdated, see #38519 (comment)
Refs: https://coverage.nodejs.org/coverage-68e6673224365120/lib/internal/fs/promises.js.html#L268