Corp/backend/finance/payroll/exceptions.py

29 lines
775 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Application-level errors raised by the Django payroll adapter."""
from __future__ import annotations
from typing import Mapping
class PayrollOperationError(Exception):
def __init__(
self,
code: str,
message: str,
*,
details: Mapping[str, object] | None = None,
):
self.code = code
self.message = message
self.details = dict(details or {})
super().__init__(f"{code}: {message}")
class PayrollPermissionDenied(PayrollOperationError):
def __init__(self, permission: str):
super().__init__(
"PERMISSION_DENIED",
"Недостаточно прав для операции с зарплатой.",
details={"permission": permission},
)