FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fs: throw rm() validation errors by cjihrig · Pull Request #35602 · nodejs/node · GitHub

/ node Public

fs: throw rm() validation errors - #35602

Closed
cjihrig wants to merge 1 commit into
nodejs:masterfrom
cjihrig:throw
Closed

fs: throw rm() validation errors#35602
cjihrig wants to merge 1 commit into
nodejs:masterfrom
cjihrig:throw

Conversation

cjihrig commented Oct 11, 2020

Copy link
Copy Markdown
Contributor

This commit updates validateRmOptions() to throw on input validation failures. This is consistent with how Node handles validation in most places across the codebase.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

This commit updates validateRmOptions() to throw on input
validation failures. This is consistent with how Node handles
validation in most places across the codebase.
nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Oct 11, 2020
aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 11, 2020
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 11, 2020

nodejs-github-bot commented Oct 11, 2020
edited by cjihrig
Loading

Copy link
Copy Markdown
Collaborator

cjihrig added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Oct 11, 2020

bcoe left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If I'm understanding this correctly, parameter validation will be a crasher, but our enforcement of missing paths/file paths will bubble as an error to the callback?

Almost wonder if these should be two different utility methods, like validateRmOptions, validateRmTarget, not a blocker, just thinking out loud about a possible refactor.

cjihrig commented Oct 12, 2020

Copy link
Copy Markdown
Contributor Author

If I'm understanding this correctly, parameter validation will be a crasher, but our enforcement of missing paths/file paths will bubble as an error to the callback?

That's right. Node's approach has historically been to throw on programming errors and use the callback for runtime errors.

Almost wonder if these should be two different utility methods, like validateRmOptions, validateRmTarget, not a blocker, just thinking out loud about a possible refactor.

If I was writing this from scratch, I'd do something like that. validateRmOptions() could be shared between the three implementations, and the stat() call could be done in a separate function, or even inlined.

I mostly just wanted to get this change in before the new function goes out in a release.

Trott commented Oct 12, 2020
edited
Loading

Copy link
Copy Markdown
Member

I'm surprised this doesn't require a test to be modified somewhere. Might be good to add a test for this.

BethGriggs added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 13, 2020

Copy link
Copy Markdown
Member

Fast-track? (to ensure we can get it into the last v14.x before LTS (refs: nodejs/Release#567 (comment))

BethGriggs added the fast-track PRs that do not need to wait for 48 hours to land. label Oct 13, 2020
github-actions Bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 13, 2020

Copy link
Copy Markdown
Contributor

Landed in ce4ac15...adf8f3d

github-actions Bot closed this Oct 13, 2020
nodejs-github-bot pushed a commit that referenced this pull request Oct 13, 2020
This commit updates validateRmOptions() to throw on input
validation failures. This is consistent with how Node handles
validation in most places across the codebase.

PR-URL: #35602
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
MylesBorins pushed a commit that referenced this pull request Oct 14, 2020
This commit updates validateRmOptions() to throw on input
validation failures. This is consistent with how Node handles
validation in most places across the codebase.

PR-URL: #35602
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
MylesBorins mentioned this pull request Oct 14, 2020
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
This commit updates validateRmOptions() to throw on input
validation failures. This is consistent with how Node handles
validation in most places across the codebase.

PR-URL: nodejs#35602
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. fast-track PRs that do not need to wait for 48 hours to land. fs Issues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL