mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: improve error handling in node_env_var.cc
PR-URL: https://github.com/nodejs/node/pull/57767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
@@ -436,15 +436,14 @@ static Intercepted EnvGetter(Local<Name> property,
|
||||
MaybeLocal<String> value_string =
|
||||
env->env_vars()->Get(env->isolate(), property.As<String>());
|
||||
|
||||
bool has_env = !value_string.IsEmpty();
|
||||
TraceEnvVar(env, "get", property.As<String>());
|
||||
|
||||
if (has_env) {
|
||||
// ToLocalChecked here is ok since we check IsEmpty above.
|
||||
info.GetReturnValue().Set(value_string.ToLocalChecked());
|
||||
return Intercepted::kYes;
|
||||
Local<Value> ret;
|
||||
if (!value_string.ToLocal(&ret)) {
|
||||
return Intercepted::kNo;
|
||||
}
|
||||
return Intercepted::kNo;
|
||||
info.GetReturnValue().Set(ret);
|
||||
return Intercepted::kYes;
|
||||
}
|
||||
|
||||
static Intercepted EnvSetter(Local<Name> property,
|
||||
|
||||
Reference in New Issue
Block a user