diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/modules/IcePy/Util.cpp | 62 | ||||
-rw-r--r-- | python/modules/IcePy/Util.h | 5 |
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&); |