mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
src: refactor SSLError case statement
- Don't use both break and return simultaneously. - Use case:/UNREACHABLE() to enforce that all cases are handled, instead of CHECK(). PR-URL: https://github.com/nodejs/node/pull/25861 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
ddd6c21046
commit
80f92cf9af
1 file changed
+9
-6
+9
-6
@@ -349,14 +349,14 @@ Local<Value> TLSWrap::GetSSLError(int status, int* err, std::string* msg) {
|
||||
case SSL_ERROR_WANT_READ:
|
||||
case SSL_ERROR_WANT_WRITE:
|
||||
case SSL_ERROR_WANT_X509_LOOKUP:
|
||||
break;
|
||||
return Local<Value>();
|
||||
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
return scope.Escape(env()->zero_return_string());
|
||||
break;
|
||||
default:
|
||||
{
|
||||
CHECK(*err == SSL_ERROR_SSL || *err == SSL_ERROR_SYSCALL);
|
||||
|
||||
case SSL_ERROR_SSL:
|
||||
case SSL_ERROR_SYSCALL:
|
||||
{
|
||||
unsigned long ssl_err = ERR_peek_error(); // NOLINT(runtime/int)
|
||||
BIO* bio = BIO_new(BIO_s_mem());
|
||||
ERR_print_errors(bio);
|
||||
@@ -409,8 +409,11 @@ Local<Value> TLSWrap::GetSSLError(int status, int* err, std::string* msg) {
|
||||
|
||||
return scope.Escape(exception);
|
||||
}
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return Local<Value>();
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user