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

errors: minor (SystemError) refactoring by BridgeAR · Pull Request #20337 · nodejs/node · GitHub

/ node Public

errors: minor (SystemError) refactoring - #20337

Closed
BridgeAR wants to merge 1 commit into
nodejs:masterfrom
BridgeAR:remove-obsolete-line
Closed

errors: minor (SystemError) refactoring#20337
BridgeAR wants to merge 1 commit into
nodejs:masterfrom
BridgeAR:remove-obsolete-line

Conversation

Copy link
Copy Markdown
Member
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

BridgeAR added the fast-track PRs that do not need to wait for 48 hours to land. label Apr 26, 2018
nodejs-github-bot added the errors Issues and PRs related to JavaScript errors originated in Node.js core. label Apr 26, 2018
addaleax previously approved these changes Apr 26, 2018

Copy link
Copy Markdown
Member Author

BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Apr 26, 2018
Comment thread lib/internal/errors.js Outdated

Copy link
Copy Markdown
Member

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

FWIW, This is not really a duplicated default. This is there to catch the possibility of something like new SystemError('foo', null), which is not handled by the default argument.

Copy link
Copy Markdown
Member

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

In that case we could still remove the default argument in the parameter list, right?

Copy link
Copy Markdown
Member

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

The current way SystemErrors are instantiated in the code base warrants that context would at least be a {}, theoretically we don't even need to handle the default argument if we are being careful with new SystemErrors.

Trott commented Apr 26, 2018

Copy link
Copy Markdown
Member

-1 to fast-tracking.

The edge case @jasnell describes likely warrants a test case.

Trott removed the fast-track PRs that do not need to wait for 48 hours to land. label Apr 26, 2018

Copy link
Copy Markdown
Member Author

I pushed another commit to remove the default values completely. They were not used at the moment. I also removed spread arguments that were unnecessary and was able to remove the default arguments in message. I renamed that function to getMessage to make clear that it is actually a function and a getter.

It is actually better not to have any default values for SystemError because that way we will detect faulty implementations early.

I also inlined a function that was only there to generate the message for SystemErrors and I found some dead code in a test. I kept it there because it seems to mirror some internal functionality.

BridgeAR changed the title errors: remove duplicated default value errors: minor (SystemError) refactoring Apr 27, 2018
BridgeAR dismissed addaleax’s stale review April 27, 2018 12:10

Removed due to the changed code. PTAL

Copy link
Copy Markdown
Member Author

@joyeecheung @jasnell @addaleax PTAL

BridgeAR commented Apr 27, 2018
edited
Loading

Copy link
Copy Markdown
Member Author

BridgeAR removed the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Apr 27, 2018
BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Apr 27, 2018
BridgeAR force-pushed the remove-obsolete-line branch from 3cb2e38 to 67612d0 Compare April 29, 2018 15:25

Copy link
Copy Markdown
Member Author

Rebased due to conflicts.

New CI https://ci.nodejs.org/job/node-test-pull-request/14583/

BridgeAR added a commit to BridgeAR/node that referenced this pull request Apr 30, 2018
This removes the former default values and the spread arguments
usage. That was unnecessary and now it does only what is necessary.
The `message` function got renamed to `getMessage` to outline that
it is actually a function and a helper function was inlined into
the SystemError constructor as it was only used there.

PR-URL: nodejs#20337
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

Copy link
Copy Markdown
Member Author

Landed in 109cfa1

BridgeAR closed this Apr 30, 2018
MylesBorins pushed a commit that referenced this pull request May 4, 2018
This removes the former default values and the spread arguments
usage. That was unnecessary and now it does only what is necessary.
The `message` function got renamed to `getMessage` to outline that
it is actually a function and a helper function was inlined into
the SystemError constructor as it was only used there.

PR-URL: #20337
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

nelsonlarocca commented May 7, 2018 via email

Copy link
Copy Markdown

devsnek removed the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label May 7, 2018
MylesBorins mentioned this pull request May 8, 2018
BridgeAR deleted the remove-obsolete-line branch January 20, 2020 11:30
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

errors Issues and PRs related to JavaScript errors originated in Node.js core.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL