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

src: improve error handling in process.env handling #57707

Closed

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Apr 1, 2025

Improve error handling by eliminating ToLocalChecked uses

@jasnell jasnell requested review from anonrig and aduh95 April 1, 2025 14:21
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. worker Issues and PRs related to Worker support. labels Apr 1, 2025

This comment was marked as outdated.

@jasnell jasnell force-pushed the jasnell/process-env-errorhandling branch from 0171633 to 1e109eb Compare April 1, 2025 17:17
@nodejs-github-bot

This comment was marked as outdated.

@jasnell jasnell added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 2, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Apr 3, 2025

@@ -421,6 +440,7 @@ static Intercepted EnvGetter(Local<Name> property,
TraceEnvVar(env, "get", property.As<String>());

if (has_env) {
// ToLocalChecked here is ok since we check IsEmpty above.
Copy link
Contributor

@aduh95 aduh95 Apr 5, 2025

Choose a reason for hiding this comment

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

Wouldn't it be worth refactoring to use ToLocal instead? (to clarify, I'm not asking you to do it, I'm curious is all, and I get that the current code would not crash as is, but might still be a good idea to refactor this for consistency sake)

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly? Not that critical tho.

jasnell added a commit that referenced this pull request Apr 5, 2025
PR-URL: #57707
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@jasnell
Copy link
Member Author

jasnell commented Apr 5, 2025

Landed in 214e3d4

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. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants