Skip to content

Commit

Permalink
Re-throw JTA related exceptions (Issue #30)
Browse files Browse the repository at this point in the history
  • Loading branch information
azzazzel committed Jun 28, 2021
1 parent 4702cf8 commit 831220e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ private void detectContext() {
owned = false;
}
} catch (SystemException ex) {
logger.warn("Had trouble trying to get BMT transaction status.", ex);
owned = false;
throw new JtaTransactionException("Had trouble trying to get BMT transaction status.", ex);
}
} else {
registry = getTransactionSynchronizationRegistry();
Expand All @@ -87,7 +86,7 @@ private void attemptBegin() {
logger.debug("Did not try to begin non-owned BMT transaction.");
}
} catch (SystemException | NotSupportedException ex) {
logger.warn("Had trouble trying to start BMT transaction.", ex);
throw new JtaTransactionException("Had trouble trying to start BMT transaction.", ex);
}
} else {
if (registry != null) {
Expand Down Expand Up @@ -118,7 +117,7 @@ private void attemptCommit() {
} catch (SystemException | RollbackException
| HeuristicMixedException | HeuristicRollbackException
| SecurityException | IllegalStateException ex) {
logger.warn("Had trouble trying to commit BMT transaction.", ex);
throw new JtaTransactionException("Had trouble trying to commit BMT transaction.", ex);
}
} else {
if (registry != null) {
Expand Down Expand Up @@ -148,7 +147,7 @@ private void attemptRollback() {
statusToString(userTransaction.getStatus()));
}
} catch (SystemException | SecurityException | IllegalStateException ex) {
logger.warn("Had trouble trying to roll back BMT transaction.", ex);
throw new JtaTransactionException("Had trouble trying to roll back BMT transaction.", ex);
}
} else {
if (registry != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.axonframework.extensions.cdi.transaction;

import org.axonframework.common.AxonException;

public class JtaTransactionException extends AxonException {


public JtaTransactionException(String message) {
super(message);
}

public JtaTransactionException(String message, Throwable cause) {
super(message, cause);
}
}

0 comments on commit 831220e

Please sign in to comment.