summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Instance.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/Instance.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/Instance.cpp')
-rw-r--r--cpp/src/Ice/Instance.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 87d15201c98..2e6ea32af08 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -980,10 +980,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
FILE* file = IceUtilInternal::freopen(stdOutFilename, "a", stdout);
if(file == 0)
{
- FileException ex(__FILE__, __LINE__);
- ex.path = stdOutFilename;
- ex.error = getSystemErrno();
- throw ex;
+ throw FileException(__FILE__, __LINE__, getSystemErrno(), stdOutFilename);
}
}
@@ -992,10 +989,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
FILE* file = IceUtilInternal::freopen(stdErrFilename, "a", stderr);
if(file == 0)
{
- FileException ex(__FILE__, __LINE__);
- ex.path = stdErrFilename;
- ex.error = getSystemErrno();
- throw ex;
+ throw FileException(__FILE__, __LINE__, getSystemErrno(), stdErrFilename);
}
}
@@ -1030,36 +1024,26 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
}
if(err != 0)
{
- Ice::SyscallException ex(__FILE__, __LINE__);
- ex.error = err;
- throw ex;
+ throw Ice::SyscallException(__FILE__, __LINE__, err);
}
else if(pw == 0)
{
- InitializationException ex(__FILE__, __LINE__);
- ex.reason ="unknown user account `" + newUser + "'";
- throw ex;
+ throw InitializationException(__FILE__, __LINE__, "unknown user account `" + newUser + "'");
}
if(setgid(pw->pw_gid) == -1)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ throw SyscallException(__FILE__, __LINE__, getSystemErrno());
}
if(initgroups(pw->pw_name, pw->pw_gid) == -1)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ throw SyscallException(__FILE__, __LINE__, getSystemErrno());
}
if(setuid(pw->pw_uid) == -1)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ throw SyscallException(__FILE__, __LINE__, getSystemErrno());
}
}
#endif
@@ -1073,9 +1057,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
WSADATA data;
if(WSAStartup(version, &data) != 0)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw SocketException(__FILE__, __LINE__, getSocketErrno());
}
#endif