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

src: fix useless call in permission.cc by tniessen · Pull Request #46833 · nodejs/node · GitHub

/ node Public

src: fix useless call in permission.cc - #46833

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:src-permission-throwaccessdenied-useless-call
Feb 27, 2023
Merged

src: fix useless call in permission.cc#46833
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:src-permission-throwaccessdenied-useless-call

Conversation

Copy link
Copy Markdown
Member

FromMaybe() has no side effects and the return value is ignored. Use Check() instead to ensure that the operation succeeded.

tniessen added c++ Issues and PRs that require attention from people who are familiar with C++. experimental Issues and PRs related to experimental features. labels Feb 25, 2023
nodejs-github-bot added the needs-ci PRs that need a full CI run. label Feb 25, 2023
tniessen added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Feb 25, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 25, 2023

This comment was marked as outdated.

addaleax left a comment

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

I agree that the current state here isn't ideal, but I'd rather fix it by doing proper error handling (i.e. return; on empty Maybe) than using .Check() and adding potential crashes here

Copy link
Copy Markdown
Member Author

@addaleax I went with Check() because the same statements already use ToLocalChecked(). Would you prefer to replace only Check() or both functions with proper error handling?

addaleax commented Feb 25, 2023
edited
Loading

Copy link
Copy Markdown
Member

@tniessen I think in ideal world we'd also handle errors from the string creation functions, but since they can only fail (afaik) if the strings exceed the maximum length of strings allowed by V8, and they (currently) only accept input that is already defined at compile time, so I don't have strong feelings about those

(The extra std::string() call here is another story, but... 🤷‍♀️)

Copy link
Copy Markdown
Member Author

@addaleax Thank you, that makes sense. I'll update it soon.

FromMaybe() has no side effects and the return value is ignored.
Instead, if Set() fails, then another exception is pending, so
return early.
tniessen force-pushed the src-permission-throwaccessdenied-useless-call branch from 5989869 to 0e95c5a Compare February 25, 2023 21:37
tniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 25, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 25, 2023

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

addaleax added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 26, 2023
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 27, 2023
nodejs-github-bot merged commit 3abbc38 into nodejs:main Feb 27, 2023

Copy link
Copy Markdown
Collaborator

Landed in 3abbc38

targos pushed a commit that referenced this pull request Mar 13, 2023
FromMaybe() has no side effects and the return value is ignored.
Instead, if Set() fails, then another exception is pending, so
return early.

PR-URL: #46833
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. experimental Issues and PRs related to experimental features. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants


Back | FazBrowse Home | New Git URL