diff options
author | Jack Lloyd <[email protected]> | 2015-12-11 09:42:06 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-11 09:42:06 -0500 |
commit | 6b9a3a534071ef84c121c406559f8fc7ad546104 (patch) | |
tree | c11480ad1f07e443ba4e992fefcd618b532c2e93 /src/lib/tls/tls_channel.cpp | |
parent | 79a51627ee11f4d7f55d589751b30463d1f02a76 (diff) |
Reroot the exception hierarchy into a toplevel Exception class
As the alternatives are unfortunate for applications trying to catch
all library errors, and it seems deriving from std::runtime_error
causes problems with MSVC DLLs (GH #340)
Effectively reverts 2837e915d82e43
Diffstat (limited to 'src/lib/tls/tls_channel.cpp')
-rw-r--r-- | src/lib/tls/tls_channel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/tls/tls_channel.cpp b/src/lib/tls/tls_channel.cpp index 5dfcec34e..c7adc18cd 100644 --- a/src/lib/tls/tls_channel.cpp +++ b/src/lib/tls/tls_channel.cpp @@ -100,7 +100,7 @@ Handshake_State& Channel::create_handshake_state(Protocol_Version version) Protocol_Version active_version = active->version(); if(active_version.is_datagram_protocol() != version.is_datagram_protocol()) - throw std::runtime_error("Active state using version " + + throw Exception("Active state using version " + active_version.to_string() + " cannot change to " + version.to_string() + @@ -158,7 +158,7 @@ void Channel::renegotiate(bool force_full_renegotiation) initiate_handshake(create_handshake_state(active->version()), force_full_renegotiation); else - throw std::runtime_error("Cannot renegotiate on inactive connection"); + throw Exception("Cannot renegotiate on inactive connection"); } size_t Channel::maximum_fragment_size() const @@ -571,7 +571,7 @@ void Channel::send_record_under_epoch(u16bit epoch, byte record_type, void Channel::send(const byte buf[], size_t buf_size) { if(!is_active()) - throw std::runtime_error("Data cannot be sent on inactive TLS connection"); + throw Exception("Data cannot be sent on inactive TLS connection"); send_record_array(sequence_numbers().current_write_epoch(), APPLICATION_DATA, buf, buf_size); @@ -701,7 +701,7 @@ SymmetricKey Channel::key_material_export(const std::string& label, { size_t context_size = context.length(); if(context_size > 0xFFFF) - throw std::runtime_error("key_material_export context is too long"); + throw Exception("key_material_export context is too long"); salt.push_back(get_byte<u16bit>(0, context_size)); salt.push_back(get_byte<u16bit>(1, context_size)); salt += to_byte_vector(context); @@ -710,7 +710,7 @@ SymmetricKey Channel::key_material_export(const std::string& label, return prf->derive_key(length, master_secret, salt); } else - throw std::runtime_error("Channel::key_material_export connection not active"); + throw Exception("Channel::key_material_export connection not active"); } } |