Skip to content

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

Closed
jasnell wants to merge 1 commit into
nodejs:mainfrom
jasnell:jasnell/process-env-errorhandling
Closed

src: improve error handling in process.env handling#57707
jasnell wants to merge 1 commit into
nodejs:mainfrom
jasnell:jasnell/process-env-errorhandling

Conversation

@jasnell

Copy link
Copy Markdown
Member

Improve error handling by eliminating ToLocalChecked uses

@jasnell
jasnell requested review from aduh95 and anonrigApril 1, 2025 14:21
@nodejs-github-botnodejs-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
Comment threadsrc/node_env_var.cc Outdated
@codecov

This comment was marked as outdated.

@jasnell
jasnellforce-pushed the jasnell/process-env-errorhandling branch from 0171633 to 1e109ebCompareApril 1, 2025 17:17
@nodejs-github-bot

This comment was marked as outdated.

@jasnelljasnell 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

nodejs-github-bot commented Apr 3, 2025

Copy link
Copy Markdown
Collaborator

Comment threadsrc/node_env_var.cc
TraceEnvVar(env, "get", property.As<String>());

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

@aduh95aduh95Apr 5, 2025

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.

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

Landed in 214e3d4

@jasnelljasnell closed this Apr 5, 2025
RafaelGSS pushed a commit that referenced this pull request May 1, 2025
PR-URL: #57707
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
RafaelGSS pushed a commit that referenced this pull request May 2, 2025
PR-URL: #57707
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95aduh95 added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label May 6, 2025
@aduh95

Copy link
Copy Markdown
Contributor

This would require a manual backport of v22.x-staging

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.backport-requested-v22.xPRs awaiting manual backport to the v22.x-staging branch.c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.workerIssues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jasnell@nodejs-github-bot@aduh95@anonrig