summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/UdpTransceiver.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-09-20 11:05:13 +0200
committerJose <jose@zeroc.com>2017-09-20 11:05:13 +0200
commit7f0816001e085f482f8f9a34b7f8e06435907510 (patch)
tree46807f18b840e1c9816cd9b4aac001c8078d8bce /cpp/src/Ice/UdpTransceiver.cpp
parentFixed Ice/acm Java7 build failure (diff)
downloadice-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/Ice/UdpTransceiver.cpp')
-rwxr-xr-xcpp/src/Ice/UdpTransceiver.cpp52
1 files changed, 13 insertions, 39 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 32a3f67b5b9..87b2790f60e 100755
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -216,9 +216,7 @@ repeat:
else
{
// No peer has sent a datagram yet.
- SocketException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ throw SocketException(__FILE__, __LINE__, 0);
}
# ifdef _WIN32
@@ -242,9 +240,7 @@ repeat:
return SocketOperationWrite;
}
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
assert(ret == static_cast<ssize_t>(buf.b.size()));
@@ -318,15 +314,11 @@ repeat:
if(connectionLost())
{
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
}
@@ -487,9 +479,7 @@ IceInternal::UdpTransceiver::startWrite(Buffer& buf)
else
{
// No peer has sent a datagram yet.
- SocketException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ throw SocketException(__FILE__, __LINE__, 0);
}
err = WSASendTo(_fd, &_write.buf, 1, &_write.count, 0, &_peerAddr.sa,
len, &_write, ICE_NULLPTR);
@@ -501,15 +491,11 @@ IceInternal::UdpTransceiver::startWrite(Buffer& buf)
{
if(connectionLost())
{
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
}
@@ -601,15 +587,11 @@ IceInternal::UdpTransceiver::finishWrite(Buffer& buf)
WSASetLastError(_write.error);
if(connectionLost())
{
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw ConnectionLostException(__FILE__, __LINE__ ,getSocketErrno());
}
else
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
#else
checkErrorCode(__FILE__, __LINE__, _write.error);
@@ -654,15 +636,11 @@ IceInternal::UdpTransceiver::startRead(Buffer& buf)
{
if(connectionLost())
{
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
}
@@ -730,15 +708,11 @@ IceInternal::UdpTransceiver::finishRead(Buffer& buf)
{
if(connectionLost())
{
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
}