@@ -612,7 +612,7 @@ bool QuicCryptoContext::SetSession(const unsigned char* data, size_t length) {
612612
613613void QuicCryptoContext::SetTLSAlert (int err) {
614614 Debug (session_, " TLS Alert [%d]: %s" , err, SSL_alert_type_string_long (err));
615- session_->SetLastError (InitQuicError (QUIC_ERROR_CRYPTO, err));
615+ session_->SetLastError (QuicError (QUIC_ERROR_CRYPTO, err));
616616}
617617
618618bool QuicCryptoContext::SetupInitialKey (const ngtcp2_cid* dcid) {
@@ -1048,7 +1048,7 @@ void QuicSession::ImmediateClose() {
10481048 QuicError last_error = GetLastError ();
10491049 Debug (this , " Immediate close with code %" PRIu64 " (%s)" ,
10501050 last_error.code ,
1051- ErrorFamilyName ( last_error.family ));
1051+ last_error.GetFamilyName ( ));
10521052
10531053 HandleScope scope (env ()->isolate ());
10541054 Context::Scope context_scope (env ()->context ());
@@ -2040,7 +2040,7 @@ void QuicSession::SilentClose(bool stateless_reset) {
20402040 QuicError last_error = GetLastError ();
20412041 Debug (this ,
20422042 " Silent close with %s code %" PRIu64 " (stateless reset? %s)" ,
2043- ErrorFamilyName ( last_error.family ),
2043+ last_error.GetFamilyName ( ),
20442044 last_error.code ,
20452045 stateless_reset ? " yes" : " no" );
20462046
@@ -3021,10 +3021,7 @@ void QuicSessionClose(const FunctionCallbackInfo<Value>& args) {
30213021 Environment* env = Environment::GetCurrent (args);
30223022 QuicSession* session;
30233023 ASSIGN_OR_RETURN_UNWRAP (&session, args.Holder ());
3024- int family = QUIC_ERROR_SESSION;
3025- uint64_t code = ExtractErrorCode (env, args[0 ]);
3026- if (!args[1 ]->Int32Value (env->context ()).To (&family)) return ;
3027- session->SetLastError (static_cast <QuicErrorFamily>(family), code);
3024+ session->SetLastError (QuicError (env, args[0 ], args[1 ]));
30283025 session->SendConnectionClose ();
30293026}
30303027
@@ -3044,11 +3041,7 @@ void QuicSessionDestroy(const FunctionCallbackInfo<Value>& args) {
30443041 Environment* env = Environment::GetCurrent (args);
30453042 QuicSession* session;
30463043 ASSIGN_OR_RETURN_UNWRAP (&session, args.Holder ());
3047- int code = 0 ;
3048- int family = QUIC_ERROR_SESSION;
3049- if (!args[0 ]->Int32Value (env->context ()).To (&code)) return ;
3050- if (!args[1 ]->Int32Value (env->context ()).To (&family)) return ;
3051- session->SetLastError (static_cast <QuicErrorFamily>(family), code);
3044+ session->SetLastError (QuicError (env, args[0 ], args[1 ]));
30523045 session->Destroy ();
30533046}
30543047
0 commit comments