@@ -99,11 +99,16 @@ class KeyGenJob final : public CryptoJob<KeyGenTraits> {
9999 AdditionalParams* params = CryptoJob<KeyGenTraits>::params ();
100100
101101 if (status_ == KeyGenJobStatus::OK) {
102- v8::Maybe< bool > ret = KeyGenTraits::EncodeKey (env, params, result );
103- if (ret. IsJust () && ret. FromJust ( )) {
102+ v8::TryCatch try_catch (env-> isolate () );
103+ if (KeyGenTraits::EncodeKey (env, params). ToLocal (result )) {
104104 *err = Undefined (env->isolate ());
105+ } else {
106+ CHECK (try_catch.HasCaught ());
107+ CHECK (try_catch.CanContinue ());
108+ *result = Undefined (env->isolate ());
109+ *err = try_catch.Exception ();
105110 }
106- return ret ;
111+ return v8::Just ( true ) ;
107112 }
108113
109114 if (errors->Empty ())
@@ -178,21 +183,19 @@ struct KeyPairGenTraits final {
178183 return KeyGenJobStatus::OK;
179184 }
180185
181- static v8::Maybe< bool > EncodeKey (
186+ static v8::MaybeLocal<v8::Value > EncodeKey (
182187 Environment* env,
183- AdditionalParameters* params,
184- v8::Local<v8::Value>* result) {
188+ AdditionalParameters* params) {
185189 v8::Local<v8::Value> keys[2 ];
186190 if (params->key
187191 .ToEncodedPublicKey (env, params->public_key_encoding , &keys[0 ])
188192 .IsNothing () ||
189193 params->key
190194 .ToEncodedPrivateKey (env, params->private_key_encoding , &keys[1 ])
191195 .IsNothing ()) {
192- return v8::Nothing< bool >();
196+ return v8::MaybeLocal<v8::Value >();
193197 }
194- *result = v8::Array::New (env->isolate (), keys, arraysize (keys));
195- return v8::Just (true );
198+ return v8::Array::New (env->isolate (), keys, arraysize (keys));
196199 }
197200};
198201
@@ -221,10 +224,9 @@ struct SecretKeyGenTraits final {
221224 Environment* env,
222225 SecretKeyGenConfig* params);
223226
224- static v8::Maybe< bool > EncodeKey (
227+ static v8::MaybeLocal<v8::Value > EncodeKey (
225228 Environment* env,
226- SecretKeyGenConfig* params,
227- v8::Local<v8::Value>* result);
229+ SecretKeyGenConfig* params);
228230};
229231
230232template <typename AlgorithmParams>
0 commit comments