diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 4ecd8a8c4204fc..739b559c3b7b22 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -1037,6 +1037,8 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& args) { // TODO(@jasnell): Should this use ThrowCryptoError? unsigned long err = ERR_get_error(); // NOLINT(runtime/int) const char* str = ERR_reason_error_string(err); + str = str != nullptr ? str : "Unknown error"; + return env->ThrowError(str); } }