diff options
author | Jack Lloyd <[email protected]> | 2015-12-19 16:09:17 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-19 16:09:17 -0500 |
commit | 0fae1884079518e4f6d1c049cc7f341cd96c8a65 (patch) | |
tree | 41e3a8aea10b7381c0e2cfd4ee019745215876ac /src/cli/tls_client.cpp | |
parent | b3da432772628fdb3eed9cf5dabb54eda0097d2b (diff) |
Remove all remaining uses of throwing a std:: exception directly
See GH #340 and 6b9a3a5 for background
Diffstat (limited to 'src/cli/tls_client.cpp')
-rw-r--r-- | src/cli/tls_client.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cli/tls_client.cpp b/src/cli/tls_client.cpp index c13e9019e..1f69473c1 100644 --- a/src/cli/tls_client.cpp +++ b/src/cli/tls_client.cpp @@ -198,16 +198,16 @@ class TLS_Client : public Command hostent* host_addr = ::gethostbyname(host.c_str()); if(!host_addr) - throw std::runtime_error("gethostbyname failed for " + host); + throw CLI_Error("gethostbyname failed for " + host); if(host_addr->h_addrtype != AF_INET) // FIXME - throw std::runtime_error(host + " has IPv6 address, not supported"); + throw CLI_Error(host + " has IPv6 address, not supported"); int type = tcp ? SOCK_STREAM : SOCK_DGRAM; int fd = ::socket(PF_INET, type, 0); if(fd == -1) - throw std::runtime_error("Unable to acquire socket"); + throw CLI_Error("Unable to acquire socket"); sockaddr_in socket_info; ::memset(&socket_info, 0, sizeof(socket_info)); @@ -223,7 +223,7 @@ class TLS_Client : public Command if(::connect(fd, (sockaddr*)&socket_info, sizeof(struct sockaddr)) != 0) { ::close(fd); - throw std::runtime_error("connect failed"); + throw CLI_Error("connect failed"); } return fd; @@ -248,7 +248,7 @@ class TLS_Client : public Command int r = send(sockfd, buf, length, MSG_NOSIGNAL); if(r == -1) - throw std::runtime_error("Socket write failed errno=" + std::to_string(errno)); + throw CLI_Error("Socket write failed errno=" + std::to_string(errno)); } static void stream_socket_write(int sockfd, const uint8_t buf[], size_t length) @@ -265,7 +265,7 @@ class TLS_Client : public Command if(errno == EINTR) sent = 0; else - throw std::runtime_error("Socket write failed errno=" + std::to_string(errno)); + throw CLI_Error("Socket write failed errno=" + std::to_string(errno)); } offset += sent; |