Skip to content

Unit Of Work Error

unit_of_work_error

Base error for Unit of Work transaction failures.

Defines UnitOfWorkError, raised when a commit or rollback operation
fails in the application layer's transactional boundary. Extends
RuntimeErrorMixin so it is catchable as RuntimeError.

UnitOfWorkError

Bases: RuntimeErrorMixin, Error[MetadataValueType]

Raised when a Unit of Work commit or rollback fails.

Indicates failure within the application layer's transactional
boundary. Extends RuntimeErrorMixin so it is catchable as
RuntimeError.

Example
error = UnitOfWorkError.from_string("Unit of Work rollback failed")
Source code in src/forging_blocks/application/errors/unit_of_work_error.py
class UnitOfWorkError[MetadataValueType = object](RuntimeErrorMixin, Error[MetadataValueType]):
    """Raised when a Unit of Work commit or rollback fails.

    Indicates failure within the application layer's transactional
    boundary. Extends ``RuntimeErrorMixin`` so it is catchable as
    ``RuntimeError``.

    Example:
        ```python
        error = UnitOfWorkError.from_string("Unit of Work rollback failed")
        ```

    """