(self, *args, **kwargs)
| 53 | fmt: str | None = None # message parametrized with results from _fmt_kwargs |
| 54 | |
| 55 | def __init__(self, *args, **kwargs): |
| 56 | self._check_params(*args, **kwargs) |
| 57 | if kwargs: |
| 58 | # This call to a virtual method from __init__ is ok in our usage |
| 59 | self.kwargs = self._check_kwargs(**kwargs) # lgtm[py/init-calls-subclass] |
| 60 | self.msg = str(self) |
| 61 | else: |
| 62 | self.kwargs = dict() # defined but empty for old mode exceptions |
| 63 | if self.msg is None: |
| 64 | # doc string is better implicit message than empty string |
| 65 | self.msg = self.__doc__ |
| 66 | if args: |
| 67 | super().__init__(*args) |
| 68 | else: |
| 69 | super().__init__(self.msg) |
| 70 | |
| 71 | def _check_params(self, *args, **kwargs): |
| 72 | """Old exceptions supported only args and not kwargs. |
nothing calls this directly
no test coverage detected