summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/bindings/qpid/python/python.i11
-rw-r--r--cpp/src/qmf/AgentSession.cpp4
2 files changed, 9 insertions, 6 deletions
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;
}
}
diff --git a/cpp/src/qmf/AgentSession.cpp b/cpp/src/qmf/AgentSession.cpp
index 8c93008a69..47e40ed24a 100644
--- a/cpp/src/qmf/AgentSession.cpp
+++ b/cpp/src/qmf/AgentSession.cpp
@@ -223,7 +223,6 @@ void AgentSessionImpl::open()
{
if (opened)
throw QmfException("The session is already open");
- opened = true;
const string addrArgs(";{create:never,node:{type:topic}}");
@@ -245,6 +244,7 @@ void AgentSessionImpl::open()
// Start the receiver thread
threadCanceled = false;
+ opened = true;
thread = new qpid::sys::Thread(*this);
// Send an initial agent heartbeat message
@@ -255,7 +255,7 @@ void AgentSessionImpl::open()
void AgentSessionImpl::close()
{
if (!opened)
- throw QmfException("The session is already closed");
+ return;
// Stop and join the receiver thread
threadCanceled = true;