diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-03-14 10:37:08 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-03-14 10:37:08 +0000 |
commit | 44711b0a5ca9d84e547ed2e06b2d8c7e72f92a1a (patch) | |
tree | 99c7820835067475babbe28bd27c037798103c81 /cpp | |
parent | Swish-e changes. (diff) | |
download | ice-44711b0a5ca9d84e547ed2e06b2d8c7e72f92a1a.tar.bz2 ice-44711b0a5ca9d84e547ed2e06b2d8c7e72f92a1a.tar.xz ice-44711b0a5ca9d84e547ed2e06b2d8c7e72f92a1a.zip |
Fixed exception handling
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/IceGrid/Parser.cpp | 86 | ||||
-rw-r--r-- | cpp/src/IceGrid/Parser.h | 2 |
2 files changed, 50 insertions, 38 deletions
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index 44c6a92b47b..83886472e5d 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -373,7 +373,7 @@ Parser::addApplication(const list<string>& origArgs) } catch(const PatchException& ex) { - patchFailed(ex.reasons); + warning(patchFailed(ex.reasons)); } } } @@ -1906,42 +1906,51 @@ Parser::invalidCommand(const list<string>& s) } } -void +string Parser::patchFailed(const Ice::StringSeq& reasons) { - ostringstream os; - IceUtil::Output out(os); - out.setIndent(2); - out << "the patch failed on some nodes:\n"; - for(Ice::StringSeq::const_iterator p = reasons.begin(); p != reasons.end(); ++p) + if(reasons.size() == 1) { - string reason = *p; - string::size_type beg = 0; - string::size_type end = reason.find_first_of("\n"); - if(end == string::npos) - { - end = reason.size(); - } - out << "- " << reason.substr(beg, end - beg); - out.inc(); - while(end < reason.size()) + ostringstream s; + s << "the patch failed:\n" << reasons[0]; + return s.str(); + } + else + { + ostringstream os; + IceUtil::Output out(os); + out.setIndent(2); + out << "the patch failed on some nodes:\n"; + for(Ice::StringSeq::const_iterator p = reasons.begin(); p != reasons.end(); ++p) { - beg = end + 1; - end = reason.find_first_of("\n", beg); + string reason = *p; + string::size_type beg = 0; + string::size_type end = reason.find_first_of("\n"); if(end == string::npos) { end = reason.size(); } - out.newline(); - out << reason.substr(beg, end - beg); - } - out.dec(); - if(p + 1 != reasons.end()) - { - out.newline(); + out << "- " << reason.substr(beg, end - beg); + out.inc(); + while(end < reason.size()) + { + beg = end + 1; + end = reason.find_first_of("\n", beg); + if(end == string::npos) + { + end = reason.size(); + } + out.newline(); + out << reason.substr(beg, end - beg); + } + out.dec(); + if(p + 1 != reasons.end()) + { + out.newline(); + } } + return os.str(); } - warning(os.str()); } void @@ -2074,6 +2083,10 @@ Parser::exception(const Ice::Exception& ex) { error("couldn't find node `" + ex.name + "'"); } + catch(const RegistryNotExistException& ex) + { + error("couldn't find registry `" + ex.name + "'"); + } catch(const ServerNotExistException& ex) { error("couldn't find server `" + ex.id + "'"); @@ -2082,6 +2095,10 @@ Parser::exception(const Ice::Exception& ex) { error("couldn't find adapter `" + ex.id + "'"); } + catch(const ObjectNotRegisteredException& ex) + { + error("couldn't find object `" + _communicator->identityToString(ex.id) + "'"); + } catch(const ObjectExistsException& ex) { error("object `" + _communicator->identityToString(ex.id) + "' already exists"); @@ -2094,16 +2111,7 @@ Parser::exception(const Ice::Exception& ex) } catch(const PatchException& ex) { - if(ex.reasons.size() == 1) - { - ostringstream s; - s << ex << ":\n" << ex.reasons[0]; - error(s.str()); - } - else - { - patchFailed(ex.reasons); - } + error(patchFailed(ex.reasons)); } catch(const BadSignalException& ex) { @@ -2115,6 +2123,10 @@ Parser::exception(const Ice::Exception& ex) { error("node `" + ex.name + "' couldn't be reached:\n" + ex.reason); } + catch(const RegistryUnreachableException& ex) + { + error("registry `" + ex.name + "' couldn't be reached:\n" + ex.reason); + } catch(const AccessDeniedException& ex) { error("couldn't update the registry, the session from `" + ex.lockUserId + "' is updating the registry"); diff --git a/cpp/src/IceGrid/Parser.h b/cpp/src/IceGrid/Parser.h index 0ec89f6900a..12f42a75bb5 100644 --- a/cpp/src/IceGrid/Parser.h +++ b/cpp/src/IceGrid/Parser.h @@ -140,7 +140,7 @@ public: void invalidCommand(const std::list<std::string>&); - void patchFailed(const Ice::StringSeq&); + std::string patchFailed(const Ice::StringSeq&); void error(const char*); void error(const std::string&); |