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/entropy/egd | |
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/entropy/egd')
-rw-r--r-- | src/lib/entropy/egd/es_egd.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/entropy/egd/es_egd.cpp b/src/lib/entropy/egd/es_egd.cpp index c3b75e8f5..8392996ab 100644 --- a/src/lib/entropy/egd/es_egd.cpp +++ b/src/lib/entropy/egd/es_egd.cpp @@ -44,7 +44,7 @@ int EGD_EntropySource::EGD_Socket::open_socket(const std::string& path) addr.sun_family = PF_LOCAL; if(path.length() >= sizeof(addr.sun_path)) - throw std::invalid_argument("EGD socket path is too long"); + throw Invalid_Argument("EGD socket path is too long"); std::strncpy(addr.sun_path, path.c_str(), sizeof(addr.sun_path)); @@ -82,19 +82,19 @@ size_t EGD_EntropySource::EGD_Socket::read(byte outbuf[], size_t length) 1, static_cast<byte>(std::min<size_t>(length, 255)) }; if(::write(m_fd, egd_read_command, 2) != 2) - throw std::runtime_error("Writing entropy read command to EGD failed"); + throw Exception("Writing entropy read command to EGD failed"); byte out_len = 0; if(::read(m_fd, &out_len, 1) != 1) - throw std::runtime_error("Reading response length from EGD failed"); + throw Exception("Reading response length from EGD failed"); if(out_len > egd_read_command[1]) - throw std::runtime_error("Bogus length field received from EGD"); + throw Exception("Bogus length field received from EGD"); ssize_t count = ::read(m_fd, outbuf, out_len); if(count != out_len) - throw std::runtime_error("Reading entropy result from EGD failed"); + throw Exception("Reading entropy result from EGD failed"); return static_cast<size_t>(count); } |