| 21 | |
| 22 | |
| 23 | class SolidUIException(Exception): |
| 24 | status = 500 |
| 25 | message = "" |
| 26 | |
| 27 | def __init__( |
| 28 | self, |
| 29 | message: str = "", |
| 30 | exception: Optional[Exception] = None, |
| 31 | error_type: Optional[SolidUIErrorType] = None, |
| 32 | ) -> None: |
| 33 | if message: |
| 34 | self.message = message |
| 35 | self._exception = exception |
| 36 | self._error_type = error_type |
| 37 | super().__init__(self.message) |
| 38 | |
| 39 | @property |
| 40 | def exception(self) -> Optional[Exception]: |
| 41 | return self._exception |
| 42 | |
| 43 | @property |
| 44 | def error_type(self) -> Optional[SolidUIErrorType]: |
| 45 | return self._error_type |
| 46 | |
| 47 | def to_dict(self) -> dict[str, Any]: |
| 48 | rv = {} |
| 49 | if hasattr(self, "message"): |
| 50 | rv["message"] = self.message |
| 51 | if self.error_type: |
| 52 | rv["error_type"] = self.error_type |
| 53 | if self.exception is not None and hasattr(self.exception, "to_dict"): |
| 54 | rv = {**rv, **self.exception.to_dict()} |
| 55 | return rv |
nothing calls this directly
no outgoing calls
no test coverage detected