src: use Maybe<void> in node::crypto::error

With recent versions of V8, it is not necessary to use Maybe<bool>
anymore.

PR-URL: https://github.com/nodejs/node/pull/53766
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Tobias Nießen authored and GitHub committed 2024-07-10 19:48:53 +00:00
1 parent fd21dd45d5
commit a848206847
1 file changed
+10 -9
+10 -9
View File
@@ -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<bool> Decorate(Environment* env, Local<Object> obj,
unsigned long err) { // NOLINT(runtime/int)
if (err == 0) return Just(true); // No decoration necessary.
Maybe<void> Decorate(Environment* env,
Local<Object> 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<bool> Decorate(Environment* env, Local<Object> obj,
if (ls != nullptr) {
if (obj->Set(context, env->library_string(),
OneByteString(isolate, ls)).IsNothing()) {
return Nothing<bool>();
return Nothing<void>();
}
}
if (fs != nullptr) {
if (obj->Set(context, env->function_string(),
OneByteString(isolate, fs)).IsNothing()) {
return Nothing<bool>();
return Nothing<void>();
}
}
if (rs != nullptr) {
if (obj->Set(context, env->reason_string(),
OneByteString(isolate, rs)).IsNothing()) {
return Nothing<bool>();
return Nothing<void>();
}
// SSL has no API to recover the error name from the number, so we
@@ -556,10 +557,10 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
if (obj->Set(env->isolate()->GetCurrentContext(),
env->code_string(),
OneByteString(env->isolate(), code)).IsNothing())
return Nothing<bool>();
return Nothing<void>();
}
return Just(true);
return JustVoid();
}
} // namespace error