Skip to content
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: fix error codes for fs.cp #41106

Merged
merged 3 commits into from
Dec 10, 2021
Merged

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Dec 7, 2021

The context passed into this error must have .code, .syscall and
.message.

node/lib/internal/errors.js

Lines 215 to 216 in 36c0ac0

// The context passed into this error must have .code, .syscall and .message,
// and may have .path and .dest.

Maybe it'd worth adding a ESLint rule to catch this kind of mistakes.

Fixes: #41104

The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: nodejs#41104
@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Dec 7, 2021
Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

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

Tests?

@aduh95
Copy link
Contributor Author

aduh95 commented Dec 7, 2021

Tests?

This only affects the error message, which is usually something we don't test. Or should I add one in test/message anyway?

EDIT: I've added a linter rule instead, PTAL.

@aduh95 aduh95 added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Dec 7, 2021
@richardlau

This comment has been minimized.

@richardlau
Copy link
Member

Tests?

This only affects the error message, which is usually something we don't test. Or should I add one in test/message anyway?

Does the .code property being added not make it through to the user code outside of the message?

Ah right, I see now. nvm.

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 7, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 7, 2021
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

LGTM. Checking a single error message might be good for the case that the SystemError implementation would change.

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 10, 2021
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 10, 2021
@nodejs-github-bot nodejs-github-bot merged commit 2f60225 into nodejs:master Dec 10, 2021
@nodejs-github-bot
Copy link
Collaborator

Landed in 2f60225

danielleadams pushed a commit that referenced this pull request Dec 13, 2021
The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: #41104

PR-URL: #41106
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 14, 2021
The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: #41104

PR-URL: #41106
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: #41104

PR-URL: #41106
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: #41104

PR-URL: #41106
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Linkgoron pushed a commit to Linkgoron/node that referenced this pull request Jan 31, 2022
The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: nodejs#41104

PR-URL: nodejs#41106
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
The context passed into this error must have `.code`, `.syscall` and
`.message`.

Fixes: #41104

PR-URL: #41106
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@danielleadams danielleadams mentioned this pull request Feb 1, 2022
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 pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fs.cp throws error with message 'cp returned undefined'
7 participants