summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/Client.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-07-24 18:23:23 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-07-24 18:23:23 +0000
commit6de52073a907e0d35657cc66b0214ba17ed19f62 (patch)
treebc81b1b5c9477a1dfb4634b4a0406a223eb2ae24 /cpp/src/IcePack/Client.cpp
parentuse ICE_HOME to find slice files (diff)
downloadice-6de52073a907e0d35657cc66b0214ba17ed19f62.tar.bz2
ice-6de52073a907e0d35657cc66b0214ba17ed19f62.tar.xz
ice-6de52073a907e0d35657cc66b0214ba17ed19f62.zip
Much improved error handling and reporting.
Diffstat (limited to 'cpp/src/IcePack/Client.cpp')
-rw-r--r--cpp/src/IcePack/Client.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/cpp/src/IcePack/Client.cpp b/cpp/src/IcePack/Client.cpp
index b4df0a15a1e..0b70eb9a98c 100644
--- a/cpp/src/IcePack/Client.cpp
+++ b/cpp/src/IcePack/Client.cpp
@@ -48,6 +48,39 @@ Client::usage()
;
}
+class AdminExceptionFactory : public Ice::UserExceptionFactory
+{
+public:
+
+ virtual void createAndThrow(const string& type)
+ {
+ if(type == "::IcePack::DeploymentException")
+ {
+ throw DeploymentException();
+ }
+ else if(type == "::IcePack::ParserDeploymentException")
+ {
+ throw ParserDeploymentException();
+ }
+ else if(type == "::IcePack::AdapterDeploymentException")
+ {
+ throw AdapterDeploymentException();
+ }
+ else if(type == "::IcePack::OfferDeploymentException")
+ {
+ throw OfferDeploymentException();
+ }
+ else if(type == "::IcePack::ServerDeploymentException")
+ {
+ throw ServerDeploymentException();
+ }
+ }
+
+ virtual void destroy()
+ {
+ }
+};
+
int
Client::run(int argc, char* argv[])
{
@@ -151,6 +184,13 @@ Client::run(int argc, char* argv[])
return EXIT_FAILURE;
}
+ Ice::UserExceptionFactoryPtr factory = new AdminExceptionFactory;
+ communicator()->addUserExceptionFactory(factory, "::IcePack::DeploymentException");
+ communicator()->addUserExceptionFactory(factory, "::IcePack::ParserDeploymentException");
+ communicator()->addUserExceptionFactory(factory, "::IcePack::AdapterDeploymentException");
+ communicator()->addUserExceptionFactory(factory, "::IcePack::ServerDeploymentException");
+ communicator()->addUserExceptionFactory(factory, "::IcePack::OfferDeploymentException");
+
ParserPtr parser = Parser::createParser(communicator(), admin);
int status = EXIT_SUCCESS;