summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-11-04 16:02:28 +0000
committerGordon Sim <gsim@apache.org>2013-11-04 16:02:28 +0000
commit35ef6db29a23cb3e6c3061ea325d0b5d660508e3 (patch)
tree171ea5c38789811648030e29f99bbc3c7526f9c5 /cpp/src
parent0baf985f809992e6ccedbe18fe6275f73fe44388 (diff)
downloadqpid-python-35ef6db29a23cb3e6c3061ea325d0b5d660508e3.tar.gz
QPID-5289: Improvements to error handling and reporting
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1538658 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/amqp/Session.cpp6
-rw-r--r--cpp/src/qpid/messaging/amqp/ConnectionContext.cpp9
2 files changed, 13 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/amqp/Session.cpp b/cpp/src/qpid/broker/amqp/Session.cpp
index 25bba04fbd..8ad95e8075 100644
--- a/cpp/src/qpid/broker/amqp/Session.cpp
+++ b/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/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp
index 5217bca7e7..f65f8e5eb0 100644
--- a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp
+++ b/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());
}
}