summaryrefslogtreecommitdiff
path: root/python/modules
diff options
context:
space:
mode:
authorAustin Henriksen <austin@zeroc.com>2018-11-20 17:09:18 -0500
committerAustin Henriksen <austin@zeroc.com>2018-11-20 17:20:19 -0500
commit576d0cc7d0518d8c5c00a60a245454ee5ef1b899 (patch)
tree80a5507f7eb87b348d017308d52893d706869239 /python/modules
parentAdded missing exceptions to setExceptionMembers in Ruby. (diff)
downloadice-576d0cc7d0518d8c5c00a60a245454ee5ef1b899.tar.bz2
ice-576d0cc7d0518d8c5c00a60a245454ee5ef1b899.tar.xz
ice-576d0cc7d0518d8c5c00a60a245454ee5ef1b899.zip
Added missing exceptions to convertLocalException in Python.
Diffstat (limited to 'python/modules')
-rw-r--r--python/modules/IcePy/Util.cpp62
-rw-r--r--python/modules/IcePy/Util.h5
2 files changed, 58 insertions, 9 deletions
diff --git a/python/modules/IcePy/Util.cpp b/python/modules/IcePy/Util.cpp
index 997d7d39663..3a7bdd72d50 100644
--- a/python/modules/IcePy/Util.cpp
+++ b/python/modules/IcePy/Util.cpp
@@ -515,6 +515,35 @@ IcePy::PyException::getTypeName()
return result;
}
+PyObject*
+IcePy::byteSeqToList(const Ice::ByteSeq& seq)
+{
+ PyObject* l = PyList_New(0);
+ if(!l)
+ {
+ return 0;
+ }
+
+ for(Ice::ByteSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ {
+ PyObject* byte = PyLong_FromLong(*p);
+ if(!byte)
+ {
+ Py_DECREF(l);
+ return 0;
+ }
+ int status = PyList_Append(l, byte);
+ Py_DECREF(byte); // Give ownership to the list.
+ if(status < 0)
+ {
+ Py_DECREF(l);
+ return 0;
+ }
+ }
+
+ return l;
+}
+
bool
IcePy::listToStringSeq(PyObject* l, Ice::StringSeq& seq)
{
@@ -774,6 +803,16 @@ convertLocalException(const Ice::LocalException& ex, PyObject* p)
IcePy::PyObjectHandle m = IcePy::createString(e.str);
PyObject_SetAttrString(p, STRCAST("str"), m.get());
}
+ catch(const Ice::EndpointSelectionTypeParseException& e)
+ {
+ IcePy::PyObjectHandle m = IcePy::createString(e.str);
+ PyObject_SetAttrString(p, STRCAST("str"), m.get());
+ }
+ catch(const Ice::VersionParseException& e)
+ {
+ IcePy::PyObjectHandle m = IcePy::createString(e.str);
+ PyObject_SetAttrString(p, STRCAST("str"), m.get());
+ }
catch(const Ice::IdentityParseException& e)
{
IcePy::PyObjectHandle m = IcePy::createString(e.str);
@@ -789,6 +828,11 @@ convertLocalException(const Ice::LocalException& ex, PyObject* p)
IcePy::PyObjectHandle m = IcePy::createIdentity(e.id);
PyObject_SetAttrString(p, STRCAST("id"), m.get());
}
+ catch(const Ice::IllegalServantException& e)
+ {
+ IcePy::PyObjectHandle m = IcePy::createString(e.reason);
+ PyObject_SetAttrString(p, STRCAST("reason"), m.get());
+ }
catch(const Ice::RequestFailedException& e)
{
IcePy::PyObjectHandle m;
@@ -819,6 +863,11 @@ convertLocalException(const Ice::LocalException& ex, PyObject* p)
m = IcePy::createString(e.host);
PyObject_SetAttrString(p, STRCAST("host"), m.get());
}
+ catch(const Ice::BadMagicException& e)
+ {
+ IcePy::PyObjectHandle m = IcePy::byteSeqToList(e.badMagic);
+ PyObject_SetAttrString(p, STRCAST("badMagic"), m.get());
+ }
catch(const Ice::UnsupportedProtocolException& e)
{
IcePy::PyObjectHandle m;
@@ -835,6 +884,10 @@ convertLocalException(const Ice::LocalException& ex, PyObject* p)
m = IcePy::createEncodingVersion(e.supported);
PyObject_SetAttrString(p, STRCAST("supported"), m.get());
}
+ catch(const Ice::ConnectionManuallyClosedException& e)
+ {
+ PyObject_SetAttrString(p, STRCAST("graceful"), e.graceful ? IcePy::getTrue() : IcePy::getFalse());
+ }
catch(const Ice::NoValueFactoryException& e)
{
IcePy::PyObjectHandle m;
@@ -868,15 +921,6 @@ convertLocalException(const Ice::LocalException& ex, PyObject* p)
IcePy::PyObjectHandle m = IcePy::createString(e.reason);
PyObject_SetAttrString(p, STRCAST("reason"), m.get());
}
- catch(const Ice::IllegalServantException& e)
- {
- IcePy::PyObjectHandle m = IcePy::createString(e.reason);
- PyObject_SetAttrString(p, STRCAST("reason"), m.get());
- }
- catch(const Ice::ConnectionManuallyClosedException& e)
- {
- PyObject_SetAttrString(p, STRCAST("graceful"), e.graceful ? IcePy::getTrue() : IcePy::getFalse());
- }
catch(const Ice::LocalException&)
{
//
diff --git a/python/modules/IcePy/Util.h b/python/modules/IcePy/Util.h
index 2b6853a7884..2017f7064fe 100644
--- a/python/modules/IcePy/Util.h
+++ b/python/modules/IcePy/Util.h
@@ -183,6 +183,11 @@ private:
};
//
+// Convert Ice::ByteSeq to a Python list.
+//
+PyObject* byteSeqToList(const Ice::ByteSeq&);
+
+//
// Convert Ice::StringSeq to and from a Python list.
//
bool listToStringSeq(PyObject*, Ice::StringSeq&);