summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp26
-rw-r--r--cpp/src/slice2cppe/Gen.cpp25
-rw-r--r--cpp/src/slice2java/Gen.cpp25
3 files changed, 45 insertions, 31 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 2c0fa1933b9..254aa82b888 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1907,19 +1907,10 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << nl << "::IceInternal::BasicStream* __is = __og.is();";
C << nl << "if(!__ok)";
C << sb;
+ C << nl << "try";
+ C << sb;
C << nl << "__is->throwException();";
C << eb;
- writeAllocateCode(C, TypeStringList(), ret);
- writeUnmarshalCode(C, outParams, ret);
- if(p->returnsClasses())
- {
- C << nl << "__is->readPendingObjects();";
- }
- if(ret)
- {
- C << nl << "return __ret;";
- }
- C << eb;
//
// Generate a catch block for each legal user exception. This is necessary
@@ -1964,6 +1955,19 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());";
C << eb;
+ C << eb;
+
+ writeAllocateCode(C, TypeStringList(), ret);
+ writeUnmarshalCode(C, outParams, ret);
+ if(p->returnsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ if(ret)
+ {
+ C << nl << "return __ret;";
+ }
+ C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
C << nl << "throw ::IceInternal::NonRepeatable(__ex);";
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index bb10821b28b..63a30074209 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -1478,15 +1478,10 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
C << nl << "::IceInternal::BasicStream* __is = __out.is();";
C << nl << "if(!__ok)";
C << sb;
+ C << nl << "try";
+ C << sb;
C << nl << "__is->throwException();";
C << eb;
- writeAllocateCode(C, TypeStringList(), ret);
- writeUnmarshalCode(C, outParams, ret);
- if(ret)
- {
- C << nl << "return __ret;";
- }
- C << eb;
//
// Generate a catch block for each legal user exception. This is necessary
@@ -1527,10 +1522,22 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
C << nl << "throw;";
C << eb;
}
- C << nl << "catch(const ::Ice::UserException&)";
+ C << nl << "catch(const ::Ice::UserException& __ex)";
C << sb;
- C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__);";
+ C << nl << "::Ice::UnknownUserException __uex(__FILE__, __LINE__);";
+ C << nl << "__uex.unknown = __ex.ice_name();";
+ C << nl << "throw __uex;";
+ C << eb;
C << eb;
+
+ writeAllocateCode(C, TypeStringList(), ret);
+ writeUnmarshalCode(C, outParams, ret);
+ if(ret)
+ {
+ C << nl << "return __ret;";
+ }
+ C << eb;
+
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
C << nl << "throw ::IceInternal::NonRepeatable(__ex);";
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index e3a1a273f23..adbcaa5607c 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -4147,8 +4147,22 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "IceInternal.BasicStream __is = __og.is();";
out << nl << "if(!__ok)";
out << sb;
+ out << nl << "try";
+ out << sb;
out << nl << "__is.throwException();";
out << eb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.UserException __ex)";
+ out << sb;
+ out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
+ out << eb;
+ out << eb;
for(pli = outParams.begin(); pli != outParams.end(); ++pli)
{
writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), false, iter, true,
@@ -4185,17 +4199,6 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
- out << sb;
- out << nl << "throw __ex;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
- out << eb;
out << nl << "catch(Ice.LocalException __ex)";
out << sb;
out << nl << "throw new IceInternal.NonRepeatable(__ex);";