From ab1e03e8cd909da6a80897287badefd3735faee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 10 Jul 2024 21:48:53 +0200 Subject: [PATCH] src: use Maybe in node::crypto::error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With recent versions of V8, it is not necessary to use Maybe anymore. PR-URL: https://github.com/nodejs/node/pull/53766 Reviewed-By: Michaƫl Zasso Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell --- src/crypto/crypto_util.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc index 5734d8fdc5505e..990638ec3993bd 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -29,7 +29,7 @@ using v8::Exception; using v8::FunctionCallbackInfo; using v8::HandleScope; using v8::Isolate; -using v8::Just; +using v8::JustVoid; using v8::Local; using v8::Maybe; using v8::MaybeLocal; @@ -457,9 +457,10 @@ ByteSource ByteSource::Foreign(const void* data, size_t size) { } namespace error { -Maybe Decorate(Environment* env, Local obj, - unsigned long err) { // NOLINT(runtime/int) - if (err == 0) return Just(true); // No decoration necessary. +Maybe Decorate(Environment* env, + Local obj, + unsigned long err) { // NOLINT(runtime/int) + if (err == 0) return JustVoid(); // No decoration necessary. const char* ls = ERR_lib_error_string(err); const char* fs = ERR_func_error_string(err); @@ -471,19 +472,19 @@ Maybe Decorate(Environment* env, Local obj, if (ls != nullptr) { if (obj->Set(context, env->library_string(), OneByteString(isolate, ls)).IsNothing()) { - return Nothing(); + return Nothing(); } } if (fs != nullptr) { if (obj->Set(context, env->function_string(), OneByteString(isolate, fs)).IsNothing()) { - return Nothing(); + return Nothing(); } } if (rs != nullptr) { if (obj->Set(context, env->reason_string(), OneByteString(isolate, rs)).IsNothing()) { - return Nothing(); + return Nothing(); } // SSL has no API to recover the error name from the number, so we @@ -556,10 +557,10 @@ Maybe Decorate(Environment* env, Local obj, if (obj->Set(env->isolate()->GetCurrentContext(), env->code_string(), OneByteString(env->isolate(), code)).IsNothing()) - return Nothing(); + return Nothing(); } - return Just(true); + return JustVoid(); } } // namespace error