dodil/erp-brick-manufacturing
DODIL ERP brick: manufacturing
src/brick_manufacturing/domain/errors.py
"""The refusals a rule makes. The use cases turn them into a 409 (a rule) or a 422 (a bound) with these words, through
both doors."""
class RuleBroken(Exception):
"""A business rule said no. The message is written for the person who tried."""
def __init__(self, message: str, gate: str = "", fix: str = ""):
super().__init__(message)
self.gate, self.fix = gate, fix
class OutOfBounds(RuleBroken):
"""A quantity, rate or amount no column can hold (or that makes no sense): a 422 {gate: bounds}, never a 500."""
def __init__(self, message: str, fix: str = ""):
super().__init__(message, "bounds", fix)