@@ -243,7 +243,7 @@ bool CryptoErrorStore::Empty() const {
243
243
return errors_.empty ();
244
244
}
245
245
246
- v8:: MaybeLocal<v8:: Value> cryptoErrorListToException (
246
+ MaybeLocal<Value> cryptoErrorListToException (
247
247
Environment* env, const ncrypto::CryptoErrorList& errors) {
248
248
// The CryptoErrorList contains a listing of zero or more errors.
249
249
// If there are no errors, it is likely a bug but we will return
@@ -261,7 +261,7 @@ v8::MaybeLocal<v8::Value> cryptoErrorListToException(
261
261
if (!String::NewFromUtf8 (
262
262
env->isolate (), last.data (), NewStringType::kNormal , last.size ())
263
263
.ToLocal (&message)) {
264
- return MaybeLocal<Value>() ;
264
+ return {} ;
265
265
}
266
266
267
267
Local<Value> exception = Exception::Error (message);
@@ -277,13 +277,9 @@ v8::MaybeLocal<v8::Value> cryptoErrorListToException(
277
277
auto last = errors.end ();
278
278
last--;
279
279
while (current != last) {
280
- Local<String> error;
281
- if (!String::NewFromUtf8 (env->isolate (),
282
- current->data (),
283
- NewStringType::kNormal ,
284
- current->size ())
285
- .ToLocal (&error)) {
286
- return MaybeLocal<Value>();
280
+ Local<Value> error;
281
+ if (!ToV8Value (env->context (), *current).ToLocal (&error)) {
282
+ return {};
287
283
}
288
284
stack.push_back (error);
289
285
++current;
@@ -295,7 +291,7 @@ v8::MaybeLocal<v8::Value> cryptoErrorListToException(
295
291
if (!exception_obj
296
292
->Set (env->context (), env->openssl_error_stack (), stackArray)
297
293
.IsNothing ()) {
298
- return MaybeLocal<Value>() ;
294
+ return {} ;
299
295
}
300
296
}
301
297
return exception ;
0 commit comments