Exception: OpenSSL::OpenSSLError
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
BNError, ConfigError, HMACError, ASN1::ASN1Error, Cipher::AuthTagError, Cipher::CipherError, Digest::DigestError, Engine::EngineError, KDF::KDFError, Netscape::SPKIError, OpenSSL::OCSP::OCSPError, PKCS12::PKCS12Error, PKCS7::PKCS7Error, PKey::PKeyError, Provider::ProviderError, Random::RandomError, SSL::SSLError, SSL::SSLErrorWaitReadable, SSL::SSLErrorWaitWritable, Timestamp::TimestampError, X509::AttributeError, X509::CRLError, X509::CertificateError, X509::ExtensionError, X509::NameError, X509::RequestError, X509::RevokedError, X509::StoreError, SSL::Session::SessionError, PKey::EC::Group::Error, PKey::EC::Point::Error
|
|
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::StandardError,
Exception
|
|
|
Instance Chain:
self,
::StandardError,
Exception
|
|
| Inherits: |
StandardError
|
| Defined in: | ext/openssl/ossl.c |
Overview
Generic error class for ::OpenSSL. All error classes in this library inherit from this class.
This class indicates that an error was reported by the underlying OpenSSL library.
Instance Attribute Summary
-
#errors
readonly
OpenSSL error queue entries captured at the time the exception was raised.
Instance Method Summary
-
#detailed_message(**) ⇒ String
Returns the exception message decorated with the captured OpenSSL error queue entries.
Instance Attribute Details
#errors (readonly)
OpenSSL error queue entries captured at the time the exception was raised. The same information is printed to stderr if OpenSSL.debug is set to true.
This is an array of zero or more strings, ordered from the oldest to the newest. The format of the strings is not stable and may vary across versions of OpenSSL or versions of this Ruby extension.
See also the man page ERR_get_error(3).
Instance Method Details
#detailed_message(**) ⇒ String
Returns the exception message decorated with the captured OpenSSL error queue entries.
# File 'ext/openssl/ossl.c', line 359
static VALUE
osslerror_detailed_message(int argc, VALUE *argv, VALUE self)
{
VALUE str;
#ifdef HAVE_RB_CALL_SUPER_KW
// Ruby >= 3.2
if (RTEST(rb_funcall(rb_eException, rb_intern("method_defined?"), 1,
ID2SYM(rb_intern("detailed_message")))))
str = rb_call_super_kw(argc, argv, RB_PASS_CALLED_KEYWORDS);
else
#endif
str = rb_funcall(self, rb_intern("message"), 0);
VALUE errors = rb_attr_get(self, id_i_errors);
// OpenSSLError was not created by ossl_make_error()
if (!RB_TYPE_P(errors, T_ARRAY))
return str;
str = rb_str_resurrect(str);
rb_str_catf(str, "\nOpenSSL error queue reported %ld errors:",
RARRAY_LEN(errors));
for (long i = 0; i < RARRAY_LEN(errors); i++) {
VALUE err = RARRAY_AREF(errors, i);
rb_str_catf(str, "\n%"PRIsVALUE, err);
}
return str;
}