diff options
| author | Ted Ross <tross@apache.org> | 2010-10-07 22:21:19 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2010-10-07 22:21:19 +0000 |
| commit | 36932c8c005b1295ca802685e040ab727f176688 (patch) | |
| tree | 7780039fa394f36112cbf9ab7478398571b7e445 /qpid/cpp/bindings | |
| parent | bb3bd520ce00588c7539b51e0df8ffbcd1e84c2d (diff) | |
| download | qpid-python-36932c8c005b1295ca802685e040ab727f176688.tar.gz | |
Fix session-shutdown-after-failure so it does not cause a segfault.
Fixed the method-call wrapper for Python in the qpid messaging wrapper to properly
handle and translate C++ exceptions.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1005654 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings')
| -rw-r--r-- | qpid/cpp/bindings/qpid/python/python.i | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/qpid/cpp/bindings/qpid/python/python.i b/qpid/cpp/bindings/qpid/python/python.i index 85dc745783..bf61cb10b7 100644 --- a/qpid/cpp/bindings/qpid/python/python.i +++ b/qpid/cpp/bindings/qpid/python/python.i @@ -23,13 +23,16 @@ /* Define the general-purpose exception handling */ %exception { + std::string error; + Py_BEGIN_ALLOW_THREADS; try { - Py_BEGIN_ALLOW_THREADS $action - Py_END_ALLOW_THREADS + } catch (qpid::types::Exception& ex) { + error = ex.what(); } - catch (qpid::messaging::MessagingException& mex) { - PyErr_SetString(PyExc_RuntimeError, mex.what()); + Py_END_ALLOW_THREADS; + if (!error.empty()) { + PyErr_SetString(PyExc_RuntimeError, error.c_str()); return NULL; } } |
