summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-09-20 11:58:41 +0200
committerJose <jose@zeroc.com>2017-09-20 11:58:41 +0200
commita2857e814eaa97eedff81036aea6e845979083a5 (patch)
treedcba44230b386403684ae6d142c759337b047273 /cpp/src
parentClean C++ exception code to only throw exception types (diff)
downloadice-a2857e814eaa97eedff81036aea6e845979083a5.tar.bz2
ice-a2857e814eaa97eedff81036aea6e845979083a5.tar.xz
ice-a2857e814eaa97eedff81036aea6e845979083a5.zip
Update Application and Service classes to catch Ice::Exception
- update Ice::Application and Ice::Service to catch Ice::Exception in addition to std::exception to get stack trace from Ice::Exception base class.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Application.cpp23
-rw-r--r--cpp/src/Ice/Service.cpp21
2 files changed, 44 insertions, 0 deletions
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index c826f07524e..660a216c131 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -91,6 +91,12 @@ Ice::Application::main(int argc, const char* const argv[], ICE_CONFIG_FILE_STRIN
initData.properties = createProperties();
initData.properties->load(configFile);
}
+ catch(const Ice::Exception& ex)
+ {
+ Error out(getProcessLogger());
+ out << ex;
+ return EXIT_FAILURE;
+ }
catch(const std::exception& ex)
{
Error out(getProcessLogger());
@@ -154,6 +160,12 @@ Ice::Application::main(int argc, const char* const argv[], const InitializationD
{
initData.properties = createProperties(av.argc, av.argv, initData.properties);
}
+ catch(const Ice::Exception& ex)
+ {
+ Error out(getProcessLogger());
+ out << ex;
+ return EXIT_FAILURE;
+ }
catch(const std::exception& ex)
{
Error out(getProcessLogger());
@@ -427,6 +439,12 @@ Ice::Application::doMain(int argc, char* argv[], const InitializationData& initD
status = run(argc, argv);
}
+ catch(const Ice::Exception& ex)
+ {
+ Error out(getProcessLogger());
+ out << ex;
+ status = EXIT_FAILURE;
+ }
catch(const std::exception& ex)
{
Error out(getProcessLogger());
@@ -614,6 +632,11 @@ Ice::Application::callbackOnInterruptCallback(int signal)
assert(_application != 0);
_application->interruptCallback(signal);
}
+ catch(const Ice::Exception& ex)
+ {
+ Error out(getProcessLogger());
+ out << "(while interrupting in response to signal " << signal << "): Ice::Exception: " << ex;
+ }
catch(const std::exception& ex)
{
Error out(getProcessLogger());
diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp
index 324abfc1115..bec4df2ded3 100644
--- a/cpp/src/Ice/Service.cpp
+++ b/cpp/src/Ice/Service.cpp
@@ -507,6 +507,11 @@ Ice::Service::shutdown()
// Expected if the service communicator is being destroyed.
//
}
+ catch(const Ice::Exception& ex)
+ {
+ ServiceWarning warn(this);
+ warn << "exception during shutdown:\n" << ex;
+ }
catch(const std::exception& ex)
{
ServiceWarning warn(this);
@@ -837,6 +842,11 @@ Ice::Service::run(int argc, const char* const argv[], const InitializationData&
}
}
}
+ catch(const Ice::Exception& ex)
+ {
+ ServiceError err(this);
+ err << "service terminating after catching exception:\n" << ex;
+ }
catch(const std::exception& ex)
{
ServiceError err(this);
@@ -1359,6 +1369,11 @@ Ice::Service::serviceMain(int argc, const wchar_t* const argv[])
status = tmpStatus;
}
}
+ catch(const Ice::Exception& ex)
+ {
+ ServiceError err(this);
+ err << "service terminating after catching exception:\n" << ex;
+ }
catch(const std::exception& ex)
{
ServiceError err(this);
@@ -1793,6 +1808,12 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa
}
}
}
+ catch(const Ice::Exception& ex)
+ {
+ ServiceError err(this);
+ err << "service terminating after catching exception:\n" << ex;
+ errMsg = err.str();
+ }
catch(const std::exception& ex)
{
ServiceError err(this);