Class UnexpectedRollbackException

All Implemented Interfaces:
Serializable

public class UnexpectedRollbackException extends UltiToolsException
Signals that a transaction's outer commit() found the transaction already marked rollback-only by a nested scope, and performed a real rollback instead of committing.

This is the analogue of the signal a Spring-family container raises (org.springframework.transaction.UnexpectedRollbackException) when an outer commit discovers an inner scope already decided the whole transaction cannot succeed. Before D-08, the inner scope's decision was discarded silently - the outer commit() logged a WARNING and returned normally, leaving the caller believing its work was persisted when it was not. Throwing this instead makes that outcome observable.

Since:
6.3.0
Author:
wisdomme
See Also:
  • Constructor Details

    • UnexpectedRollbackException

      public UnexpectedRollbackException(String message)
      Creates a new unexpected-rollback exception with a generic error code.
      Parameters:
      message - the error message
    • UnexpectedRollbackException

      public UnexpectedRollbackException(ErrorCode errorCode, String message)
      Creates a new unexpected-rollback exception with a specific error code.
      Parameters:
      errorCode - the error code
      message - the error message
    • UnexpectedRollbackException

      public UnexpectedRollbackException(String message, Throwable cause)
      Creates a new unexpected-rollback exception with message and cause.
      Parameters:
      message - the error message
      cause - the underlying cause
    • UnexpectedRollbackException

      public UnexpectedRollbackException(ErrorCode errorCode, String message, Throwable cause)
      Creates a new unexpected-rollback exception with error code, message, and cause.
      Parameters:
      errorCode - the error code
      message - the error message
      cause - the underlying cause
  • Method Details

    • markedBy

      public static UnexpectedRollbackException markedBy(String origin)
      Creates an exception naming the nested scope that marked the transaction rollback-only.
      Parameters:
      origin - a description of the nested scope that set the marker (e.g. a method name or transaction depth) - included verbatim in the message
      Returns:
      a new UnexpectedRollbackException