diff options
Diffstat (limited to 'qpid/cpp')
| -rw-r--r-- | qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp | 16 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/MessagingSessionTests.cpp | 19 |
2 files changed, 34 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp b/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp index d99407112b..8c6eef6273 100644 --- a/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp +++ b/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp @@ -62,7 +62,21 @@ void SessionImpl::checkError() { ScopedLock l(lock); qpid::client::SessionBase_0_10Access s(session); - s.get()->assertOpen(); + try { + s.get()->assertOpen(); + } catch (const qpid::TransportFailure&) { + throw qpid::messaging::TransportFailure(std::string()); + } catch (const qpid::framing::ResourceLimitExceededException& e) { + throw qpid::messaging::TargetCapacityExceeded(e.what()); + } catch (const qpid::framing::UnauthorizedAccessException& e) { + throw qpid::messaging::UnauthorizedAccess(e.what()); + } catch (const qpid::SessionException& e) { + throw qpid::messaging::SessionError(e.what()); + } catch (const qpid::ConnectionException& e) { + throw qpid::messaging::ConnectionError(e.what()); + } catch (const qpid::Exception& e) { + throw qpid::messaging::MessagingException(e.what()); + } } bool SessionImpl::hasError() diff --git a/qpid/cpp/src/tests/MessagingSessionTests.cpp b/qpid/cpp/src/tests/MessagingSessionTests.cpp index d23619e846..0926765d78 100644 --- a/qpid/cpp/src/tests/MessagingSessionTests.cpp +++ b/qpid/cpp/src/tests/MessagingSessionTests.cpp @@ -1432,6 +1432,25 @@ QPID_AUTO_TEST_CASE(testCloseAndMultipleConcurrentFetches) BOOST_CHECK(!fetcher.timedOut); } +QPID_AUTO_TEST_CASE(testSessionCheckError) +{ + MessagingFixture fix; + std::string queue(); + Session session = fix.connection.createSession(); + Sender sender = session.createSender("q; {create:always, node:{x-declare:{auto-delete:True, arguments:{qpid.max_count:1}}}}"); + ScopedSuppressLogging sl; + for (uint i = 0; i < 2; ++i) { + sender.send(Message((boost::format("A_%1%") % (i+1)).str())); + } + try { + while (true) session.checkError(); + } catch (const qpid::types::Exception&) { + //this is ok + } catch (const qpid::Exception&) { + BOOST_FAIL("Wrong exception type thrown"); + } +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests |
