summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-06-10 09:59:17 +0000
committerGordon Sim <gsim@apache.org>2008-06-10 09:59:17 +0000
commit841d89675133443c4058bd147575fa959433fe99 (patch)
treeea46f6e3c76b563dbc0984c36cb9a3fc846b9c72 /cpp/src
parent03a39d920d010b29b156a99ee9b3fcfc7c7c64a1 (diff)
downloadqpid-python-841d89675133443c4058bd147575fa959433fe99.tar.gz
Improved exception handling for commit.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@666051 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/TxBuffer.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/cpp/src/qpid/broker/TxBuffer.cpp b/cpp/src/qpid/broker/TxBuffer.cpp
index 5b5b00e929..cdc5b37dfd 100644
--- a/cpp/src/qpid/broker/TxBuffer.cpp
+++ b/cpp/src/qpid/broker/TxBuffer.cpp
@@ -19,6 +19,7 @@
*
*/
#include "TxBuffer.h"
+#include "qpid/log/Statement.h"
#include <boost/mem_fn.hpp>
using boost::mem_fn;
@@ -53,15 +54,22 @@ void TxBuffer::enlist(TxOp::shared_ptr op)
bool TxBuffer::commitLocal(TransactionalStore* const store)
{
- std::auto_ptr<TransactionContext> ctxt;
- if(store) ctxt = store->begin();
- if (prepare(ctxt.get())) {
- if(store) store->commit(*ctxt);
- commit();
- return true;
- } else {
- if(store) store->abort(*ctxt);
- rollback();
- return false;
+ if (!store) return false;
+ try {
+ std::auto_ptr<TransactionContext> ctxt = store->begin();
+ if (prepare(ctxt.get())) {
+ store->commit(*ctxt);
+ commit();
+ return true;
+ } else {
+ store->abort(*ctxt);
+ rollback();
+ return false;
+ }
+ } catch (std::exception& e) {
+ QPID_LOG(error, "Commit failed with exception: " << e.what());
+ } catch (...) {
+ QPID_LOG(error, "Commit failed with unknown exception");
}
+ return false;
}