| 4 | |
| 5 | @dc.dataclass |
| 6 | class ClinicError(Exception): |
| 7 | message: str |
| 8 | _: dc.KW_ONLY |
| 9 | lineno: int | None = None |
| 10 | filename: str | None = None |
| 11 | |
| 12 | def __post_init__(self) -> None: |
| 13 | super().__init__(self.message) |
| 14 | |
| 15 | def report(self, *, warn_only: bool = False) -> str: |
| 16 | msg = "Warning" if warn_only else "Error" |
| 17 | if self.filename is not None: |
| 18 | msg += f" in file {self.filename!r}" |
| 19 | if self.lineno is not None: |
| 20 | msg += f" on line {self.lineno}" |
| 21 | msg += ":\n" |
| 22 | msg += f"{self.message}\n" |
| 23 | return msg |
| 24 | |
| 25 | |
| 26 | class ParseError(ClinicError): |
no outgoing calls
no test coverage detected
searching dependent graphs…