From 0ab3a58ce116a5a2c68627b9456060b3a1abd2ec Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 3 Jun 2008 12:39:14 +0000 Subject: Better exception handling for commit. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@662774 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/SemanticState.cpp | 2 ++ qpid/cpp/src/qpid/broker/TxPublish.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/SemanticState.cpp b/qpid/cpp/src/qpid/broker/SemanticState.cpp index 3c4f6abc30..b3167d0377 100644 --- a/qpid/cpp/src/qpid/broker/SemanticState.cpp +++ b/qpid/cpp/src/qpid/broker/SemanticState.cpp @@ -127,6 +127,8 @@ void SemanticState::commit(MessageStore* const store, bool completeOnCommit) txBuffer->enlist(txAck); if (txBuffer->commitLocal(store)) { accumulatedAck.clear(); + } else { + throw InternalErrorException(QPID_MSG("Commit failed")); } } diff --git a/qpid/cpp/src/qpid/broker/TxPublish.cpp b/qpid/cpp/src/qpid/broker/TxPublish.cpp index 1a8630eb54..dcee00e803 100644 --- a/qpid/cpp/src/qpid/broker/TxPublish.cpp +++ b/qpid/cpp/src/qpid/broker/TxPublish.cpp @@ -30,10 +30,12 @@ bool TxPublish::prepare(TransactionContext* ctxt) throw(){ try{ for_each(queues.begin(), queues.end(), Prepare(ctxt, msg)); return true; + }catch(const std::exception& e){ + QPID_LOG(error, "Failed to prepare: " << e.what()); }catch(...){ - QPID_LOG(error, "Failed to prepare"); - return false; + QPID_LOG(error, "Failed to prepare (unknown error)"); } + return false; } void TxPublish::commit() throw(){ -- cgit v1.2.1