diff options
author | Gordon Sim <gsim@apache.org> | 2013-11-04 16:02:28 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2013-11-04 16:02:28 +0000 |
commit | c6ecb6e200cf2e59f678abdda0886d2c42f61548 (patch) | |
tree | a98ab6a5f694dd9a6c22f0121b7b377bcf747621 | |
parent | 7a819a9d3bfbc2baad22943d5d6d93b0a5e32dde (diff) | |
download | qpid-python-c6ecb6e200cf2e59f678abdda0886d2c42f61548.tar.gz |
QPID-5289: Improvements to error handling and reporting
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1538658 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/amqp/Session.cpp | 6 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/broker/amqp/Session.cpp b/qpid/cpp/src/qpid/broker/amqp/Session.cpp index 25bba04fbd..8ad95e8075 100644 --- a/qpid/cpp/src/qpid/broker/amqp/Session.cpp +++ b/qpid/cpp/src/qpid/broker/amqp/Session.cpp @@ -652,7 +652,11 @@ void IncomingToQueue::handle(qpid::broker::Message& message) msg << " Queue " << queue->getName() << " has been deleted"; throw Exception(qpid::amqp::error_conditions::RESOURCE_DELETED, msg.str()); } - queue->deliver(message); + try { + queue->deliver(message); + } catch (const qpid::SessionException& e) { + throw Exception(qpid::amqp::error_conditions::PRECONDITION_FAILED, e.what()); + } } void IncomingToExchange::handle(qpid::broker::Message& message) diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index 5217bca7e7..f65f8e5eb0 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -412,8 +412,15 @@ void ConnectionContext::check() } } if ((pn_connection_state(connection) & REQUIRES_CLOSE) == REQUIRES_CLOSE) { + pn_condition_t* error = pn_connection_remote_condition(connection); + std::stringstream text; + if (pn_condition_is_set(error)) { + text << "Connection closed by peer with " << pn_condition_get_name(error) << ": " << pn_condition_get_description(error); + } else { + text << "Connection closed by peer"; + } pn_connection_close(connection); - throw qpid::messaging::ConnectionError("Connection closed by peer"); + throw qpid::messaging::ConnectionError(text.str()); } } |