summaryrefslogtreecommitdiff
path: root/cpp/src/IceBox/ServiceManagerI.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/IceBox/ServiceManagerI.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/IceBox/ServiceManagerI.cpp')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp40
1 files changed, 14 insertions, 26 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 2f027994814..0f26b5a6c30 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -50,9 +50,8 @@ struct StartServiceInfo
}
catch(const IceUtilInternal::BadOptException& ex)
{
- FailureException e(__FILE__, __LINE__);
- e.reason = "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason;
- throw e;
+ throw FailureException(__FILE__, __LINE__, "ServiceManager: invalid arguments for service `" + name +
+ "':\n" + ex.reason);
}
assert(!args.empty());
@@ -365,9 +364,8 @@ IceBox::ServiceManagerI::start()
p = services.find(prefix + *q);
if(p == services.end())
{
- FailureException ex(__FILE__, __LINE__);
- ex.reason = "ServiceManager: no service definition for `" + *q + "'";
- throw ex;
+ throw FailureException(__FILE__, __LINE__, "ServiceManager: no service definition for `" +
+ *q + "'");
}
servicesInfo.push_back(StartServiceInfo(*q, p->second, _argv));
services.erase(p);
@@ -558,14 +556,14 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
IceInternal::DynamicLibrary::symbol_type sym = library->loadEntryPoint(entryPoint, false);
if(sym == 0)
{
- string msg = library->getErrorMessage();
- FailureException ex(__FILE__, __LINE__);
- ex.reason = "ServiceManager: unable to load entry point `" + entryPoint + "'";
+ ostringstream os;
+ os << "ServiceManager: unable to load entry point `" << entryPoint << "'";
+ const string msg = library->getErrorMessage();
if(!msg.empty())
{
- ex.reason += ": " + msg;
+ os << ": " + msg;
}
- throw ex;
+ throw FailureException(__FILE__, __LINE__, os.str());
}
ServiceInfo info;
@@ -667,9 +665,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
s << "ServiceManager: exception while starting service " << service << ":\n";
s << ex;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
- throw e;
+ throw FailureException(__FILE__, __LINE__, s.str());
}
}
@@ -698,18 +694,14 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
s << "ServiceManager: exception in entry point `" + entryPoint + "' for service " << info.name << ":\n";
s << ex;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
- throw e;
+ throw FailureException(__FILE__, __LINE__, s.str());
}
catch(...)
{
ostringstream s;
s << "ServiceManager: unknown exception in entry point `" + entryPoint + "' for service " << info.name;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
- throw e;
+ throw FailureException(__FILE__, __LINE__, s.str());
}
//
@@ -736,18 +728,14 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
s << "ServiceManager: exception while starting service " << info.name << ":\n";
s << ex;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
- throw e;
+ throw FailureException(__FILE__, __LINE__, s.str());
}
catch(...)
{
ostringstream s;
s << "ServiceManager: unknown exception while starting service " << info.name;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
- throw e;
+ throw FailureException(__FILE__, __LINE__, s.str());
}
info.library = library;