dodil/erp-brick-payroll

DODIL ERP brick: payroll

src/brick_payroll/domain/errors.py

"""The one refusal a rule makes. The use cases turn it into a 409 with these words (and its gate), through both doors."""
from typing import Optional


class RuleBroken(Exception):
    """A business rule said no. The message is written for the person who tried; `gate` names the readiness gate."""

    def __init__(self, message: str, gate: Optional[str] = None, fix: Optional[str] = None):
        super().__init__(message)
        self.gate, self.fix = gate, fix