errors.py

clew/guard/errors.py

Typed exceptions for clew guard.

__init__

None clew.guard.errors.GuardError.__init__(self, str message, list[str]|None problems=None)

Build an error carrying one or more human-readable problem descriptions.

clew/guard/errors.py:20

Show on the map →

Called by none

Calls none

Source · 5 lines
    def __init__(self, message: str, problems: list[str] | None = None) -> None:
        super().__init__(message)
        self.message = message
        self.problems: list[str] = problems or []
Activity · 3 steps
lines 21–21super().__init__(message)lines 22–22self.message = messagelines 23–23self.problems: list[str] = problems or []

Requirements

REQ-DDB-GUARD-014

__str__

str clew.guard.errors.GuardError.__str__(self)

Render the full detail, so a caller printing str(e) sees every problem.

clew/guard/errors.py:36

Show on the map →

Called by none

Calls details

Source · 4 lines
    def __str__(self) -> str:
        return self.details()

Activity · 1 steps
lines 37–37return self.details()

Requirements

REQ-DDB-GUARD-014

details

str clew.guard.errors.GuardError.details(self)

Render the message followed by each individual problem.

clew/guard/errors.py:29

Show on the map →

Called by __str__

Calls message

Source · 3 lines
    def details(self) -> str:
        return "\n".join([self.message, *self.problems])
Activity · 1 steps
lines 30–30return "\n".join([self.message, *self.problems])

Requirements

REQ-DDB-GUARD-014