"""Custom exceptions module.""" class PermanentError(Exception): """Base class for permanent errors (non-retriable). Permanent errors represent failures that cannot be resolved by retrying the operation, such as validation errors, missing data, or logic errors. """ pass class StatementPeriodPaymentEntityNotFoundError(PermanentError): """Raised when statement_period_payment_entity is not found.""" pass class BalancesNotClosedError(PermanentError): """Raised when close_balance action is not complete.""" pass class TransientError(Exception): """Retriable transient error (network, throttling, temporary failures). Transient errors represent temporary failures that may succeed if retried, such as network timeouts, database connection issues, or service throttling. """ pass class OwsServiceException(Exception): """Custom exception when making ows service requests.""" pass def raise_service_error(error_msg: str, service: str, **kwargs: dict) -> None: """Log and raise appropriate service error.""" raise OwsServiceException(f'{service} failure: {error_msg} {kwargs}')