diff options
author | Jack Lloyd <[email protected]> | 2018-11-17 16:23:51 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-11-23 11:15:25 -0500 |
commit | b909778857b3e0b7eb86ac26c818e5f25baaddbd (patch) | |
tree | f8a5c9cbec26310bbfc9077563892b04db158a48 /src/lib/tls/tls_callbacks.cpp | |
parent | c20a428ca2f7c1ef96e642f55bb898010444c499 (diff) |
Make exceptions easier to translate to error codes
Avoid throwing base Botan::Exception type, as it is difficult to
determine what the error is in that case.
Add Exception::error_code and Exception::error_type which allows
(for error code) more information about the error and (for error type)
allows knowing the error type without requiring a sequence of catches.
See GH #1742
Diffstat (limited to 'src/lib/tls/tls_callbacks.cpp')
-rw-r--r-- | src/lib/tls/tls_callbacks.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/tls/tls_callbacks.cpp b/src/lib/tls/tls_callbacks.cpp index 6919c36ca..28884c1e2 100644 --- a/src/lib/tls/tls_callbacks.cpp +++ b/src/lib/tls/tls_callbacks.cpp @@ -71,7 +71,10 @@ void TLS::Callbacks::tls_verify_cert_chain( ocsp_responses); if(!result.successful_validation()) - throw Exception("Certificate validation failure: " + result.result_string()); + { + throw TLS_Exception(Alert::BAD_CERTIFICATE, + "Certificate validation failure: " + result.result_string()); + } } std::vector<uint8_t> TLS::Callbacks::tls_sign_message( |