summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2007-10-18 19:37:48 +1000
committerMichi Henning <michi@zeroc.com>2007-10-18 19:37:48 +1000
commitf9cda6ccd07f961ddb97e61a764d81c62add6ef5 (patch)
tree93c518180fd9570e52a0a6f2d178f8443d8e75a0 /cpp
parentFix to previous fix. (diff)
downloadice-f9cda6ccd07f961ddb97e61a764d81c62add6ef5.tar.bz2
ice-f9cda6ccd07f961ddb97e61a764d81c62add6ef5.tar.xz
ice-f9cda6ccd07f961ddb97e61a764d81c62add6ef5.zip
UnexpectedObjectException change merged from C# and Java.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Exception.h7
-rw-r--r--cpp/src/Ice/Exception.cpp19
-rwxr-xr-xcpp/src/slice2cpp/Gen.cpp5
3 files changed, 27 insertions, 4 deletions
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h
index e22929c994b..a1814049dc1 100644
--- a/cpp/include/Ice/Exception.h
+++ b/cpp/include/Ice/Exception.h
@@ -19,6 +19,13 @@ namespace IceInternal
class BasicStream;
+namespace Ex
+{
+
+ICE_API void throwUOE(const ::std::string&, const ::std::string&);
+
+}
+
}
namespace Ice
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index 84a78413c15..2510db8cffa 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -18,6 +18,25 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
+namespace IceInternal
+{
+
+namespace Ex
+{
+
+void
+throwUOE(const string& expectedType, const string& actualType)
+{
+ throw Ice::UnexpectedObjectException(__FILE__, __LINE__,
+ "expected element of type `" + expectedType + "' but received '" + actualType,
+ actualType, expectedType);
+}
+
+}
+
+}
+
+
bool
Ice::UserException::__usesClasses() const
{
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index b68b987de22..c1dbbee6d2b 100755
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -3808,10 +3808,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "*p = " << scope << name << "Ptr::dynamicCast(v);";
C << nl << "if(v && !*p)";
C << sb;
- C << nl << "::Ice::UnexpectedObjectException e(__FILE__, __LINE__);";
- C << nl << "e.type = v->ice_id();";
- C << nl << "e.expectedType = " << scope << fixKwd(name) << "::ice_staticId();";
- C << nl << "throw e;";
+ C << nl << "IceInternal::Ex::throwUOE(" << scope << name << "::ice_staticId(), v->ice_id());";
C << eb;
C << eb;