From 060d901f87b3d87314f8540eb02f315e2952f581 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 9 Apr 2019 15:21:36 -0700 Subject: src: replace FromJust() with Check() when possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FromJust() is often used not for its return value, but for its side-effects. In these cases, Check() exists, and is more clear as to the intent. From its comment: To be used, where the actual value of the Maybe is not needed, like Object::Set. See: https://github.com/nodejs/node/pull/26929/files#r269256335 PR-URL: https://github.com/nodejs/node/pull/27162 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaƫl Zasso Reviewed-By: Ben Noordhuis Reviewed-By: Gus Caplan Reviewed-By: Yongsheng Zhang --- src/uv.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/uv.cc') diff --git a/src/uv.cc b/src/uv.cc index 59469fc307..0c937e876f 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -111,7 +111,7 @@ void Initialize(Local target, FIXED_ONE_BYTE_STRING(isolate, "errname"), env->NewFunctionTemplate(ErrName) ->GetFunction(env->context()) - .ToLocalChecked()).FromJust(); + .ToLocalChecked()).Check(); // TODO(joyeecheung): This should be deprecated in user land in favor of // `util.getSystemErrorName(err)`. @@ -124,7 +124,7 @@ void Initialize(Local target, const std::string prefixed_name = prefix + error.name; Local name = OneByteString(isolate, prefixed_name.c_str()); Local value = Integer::New(isolate, error.value); - target->DefineOwnProperty(context, name, value, attributes).FromJust(); + target->DefineOwnProperty(context, name, value, attributes).Check(); } env->SetMethod(target, "getErrorMap", GetErrMap); -- cgit v1.2.3