diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-12-10 13:41:49 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-12-10 13:41:49 -0800 |
commit | 47bc7e93cb03a077c0eef8a2cc871cead1212c00 (patch) | |
tree | 477aa3c5c77a5b458abc19b92c3ca12360c996a5 /cpp/src/Ice/Instance.cpp | |
parent | Squashed commit of the following: (diff) | |
download | ice-47bc7e93cb03a077c0eef8a2cc871cead1212c00.tar.bz2 ice-47bc7e93cb03a077c0eef8a2cc871cead1212c00.tar.xz ice-47bc7e93cb03a077c0eef8a2cc871cead1212c00.zip |
bug 4355 - improve parse exception messages
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 24540c65491..f42191c8246 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -406,7 +406,7 @@ IceInternal::Instance::stringToIdentity(const string& s) const // Extra unescaped slash found. // IdentityParseException ex(__FILE__, __LINE__); - ex.str = s; + ex.str = "unescaped backslash in identity `" + s + "'"; throw ex; } } @@ -415,27 +415,39 @@ IceInternal::Instance::stringToIdentity(const string& s) const if(slash == string::npos) { - if(!IceUtilInternal::unescapeString(s, 0, s.size(), ident.name)) + try + { + ident.name = IceUtilInternal::unescapeString(s, 0, s.size()); + } + catch(const IceUtil::IllegalArgumentException& e) { IdentityParseException ex(__FILE__, __LINE__); - ex.str = s; + ex.str = "invalid identity name `" + s + "': " + e.reason(); throw ex; } } else { - if(!IceUtilInternal::unescapeString(s, 0, slash, ident.category)) + try + { + ident.category = IceUtilInternal::unescapeString(s, 0, slash); + } + catch(const IceUtil::IllegalArgumentException& e) { IdentityParseException ex(__FILE__, __LINE__); - ex.str = s; + ex.str = "invalid category in identity `" + s + "': " + e.reason(); throw ex; } if(slash + 1 < s.size()) { - if(!IceUtilInternal::unescapeString(s, slash + 1, s.size(), ident.name)) + try + { + ident.name = IceUtilInternal::unescapeString(s, slash + 1, s.size()); + } + catch(const IceUtil::IllegalArgumentException& e) { IdentityParseException ex(__FILE__, __LINE__); - ex.str = s; + ex.str = "invalid name in identity `" + s + "': " + e.reason(); throw ex; } } |