diff options
author | Jose <jose@zeroc.com> | 2017-09-20 11:05:13 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-09-20 11:05:13 +0200 |
commit | 7f0816001e085f482f8f9a34b7f8e06435907510 (patch) | |
tree | 46807f18b840e1c9816cd9b4aac001c8078d8bce /cpp/src/IceBT/StreamSocket.cpp | |
parent | Fixed Ice/acm Java7 build failure (diff) | |
download | ice-7f0816001e085f482f8f9a34b7f8e06435907510.tar.bz2 ice-7f0816001e085f482f8f9a34b7f8e06435907510.tar.xz ice-7f0816001e085f482f8f9a34b7f8e06435907510.zip |
Clean C++ exception code to only throw exception types
- Update C++ code to only throw types derived from
C++ exception
- Update C++ code to use one-shot constructors to
create the exceptions
Fix bug ICE-7892
Diffstat (limited to 'cpp/src/IceBT/StreamSocket.cpp')
-rw-r--r-- | cpp/src/IceBT/StreamSocket.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/cpp/src/IceBT/StreamSocket.cpp b/cpp/src/IceBT/StreamSocket.cpp index 6cc5c67c741..15a5d7eaf54 100644 --- a/cpp/src/IceBT/StreamSocket.cpp +++ b/cpp/src/IceBT/StreamSocket.cpp @@ -128,9 +128,7 @@ IceBT::StreamSocket::read(char* buf, size_t length) ssize_t ret = ::recv(_fd, buf, packetSize, 0); if(ret == 0) { - Ice::ConnectionLostException ex(__FILE__, __LINE__); - ex.error = 0; - throw ex; + throw Ice::ConnectionLostException(__FILE__, __LINE__, 0); } else if(ret == SOCKET_ERROR) { @@ -152,15 +150,11 @@ IceBT::StreamSocket::read(char* buf, size_t length) if(IceInternal::connectionLost()) { - Ice::ConnectionLostException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; + throw Ice::ConnectionLostException(__FILE__, __LINE__, IceInternal::getSocketErrno()); } else { - Ice::SocketException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; + throw Ice::ConnectionLostException(__FILE__, __LINE__, IceInternal::getSocketErrno()); } } @@ -189,9 +183,7 @@ IceBT::StreamSocket::write(const char* buf, size_t length) ssize_t ret = ::send(_fd, buf, packetSize, 0); if(ret == 0) { - Ice::ConnectionLostException ex(__FILE__, __LINE__); - ex.error = 0; - throw ex; + throw Ice::ConnectionLostException(__FILE__, __LINE__, 0); } else if(ret == SOCKET_ERROR) { @@ -213,15 +205,11 @@ IceBT::StreamSocket::write(const char* buf, size_t length) if(IceInternal::connectionLost()) { - Ice::ConnectionLostException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; + throw Ice::ConnectionLostException(__FILE__, __LINE__, IceInternal::getSocketErrno()); } else { - Ice::SocketException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; + throw Ice::SocketException(__FILE__, __LINE__, IceInternal::getSocketErrno()); } } |