diff options
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 13 | ||||
| -rw-r--r-- | qpid/tests/src/py/qpid_tests/broker_0_10/new_api.py | 7 |
2 files changed, 18 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index 0083a2e390..6d182f40f8 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -25,6 +25,7 @@ #include "SenderContext.h" #include "SessionContext.h" #include "Transport.h" +#include "qpid/amqp/descriptors.h" #include "qpid/messaging/exceptions.h" #include "qpid/messaging/AddressImpl.h" #include "qpid/messaging/Duration.h" @@ -597,14 +598,22 @@ void ConnectionContext::checkClosed(boost::shared_ptr<SessionContext> ssn, pn_li checkClosed(ssn); if ((pn_link_state(lnk) & REQUIRES_CLOSE) == REQUIRES_CLOSE) { pn_condition_t* error = pn_link_remote_condition(lnk); + std::string name; std::stringstream text; if (pn_condition_is_set(error)) { - text << "Link detached by peer with " << pn_condition_get_name(error) << ": " << pn_condition_get_description(error); + name = pn_condition_get_name(error); + text << "Link detached by peer with " << name << ": " << pn_condition_get_description(error); } else { text << "Link detached by peer"; } pn_link_close(lnk); - throw qpid::messaging::LinkError(text.str()); + if (name == qpid::amqp::error_conditions::NOT_FOUND) { + throw qpid::messaging::NotFound(text.str()); + } else if (name == qpid::amqp::error_conditions::UNAUTHORIZED_ACCESS) { + throw qpid::messaging::UnauthorizedAccess(text.str()); + } else { + throw qpid::messaging::LinkError(text.str()); + } } else if ((pn_link_state(lnk) & IS_CLOSED) == IS_CLOSED) { throw qpid::messaging::LinkError("Link is not attached"); } diff --git a/qpid/tests/src/py/qpid_tests/broker_0_10/new_api.py b/qpid/tests/src/py/qpid_tests/broker_0_10/new_api.py index 617f1ab666..4140307266 100644 --- a/qpid/tests/src/py/qpid_tests/broker_0_10/new_api.py +++ b/qpid/tests/src/py/qpid_tests/broker_0_10/new_api.py @@ -48,6 +48,13 @@ class GeneralTests(Base): def setup_session(self): return self.conn.session() + def test_not_found(self): + ssn = self.setup_session() + try: + ssn.receiver("does-not-exist") + self.fail("Expected non-existent node to cause NotFound exception") + except NotFound, e: None + def test_qpid_3481_acquired_to_alt_exchange(self): """ Verify that acquired messages are routed to the alternate when the queue is deleted. |
