From b54fa57683bee495add37e7c89d56ae790282add Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Thu, 7 Oct 2010 22:21:19 +0000 Subject: 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/qpid@1005654 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qpid/python/python.i | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cpp/bindings/qpid/python') diff --git a/cpp/bindings/qpid/python/python.i b/cpp/bindings/qpid/python/python.i index 85dc745783..bf61cb10b7 100644 --- a/cpp/bindings/qpid/python/python.i +++ b/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; } } -- cgit v1.2.1