blob: 0d2bf797db17b083a496c19fa3395ef8819fa8a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from typing import NoReturn
class CruException(Exception):
"""Base exception class of all exceptions in cru."""
class CruUnreachableError(CruException):
"""Raised when a code path is unreachable."""
def cru_unreachable() -> NoReturn:
raise CruUnreachableError()
class CruInternalError(CruException):
"""Raised when an internal logic error occurs."""
class CruUserFriendlyException(CruException):
def __init__(self, message: str, user_message: str, *args, **kwargs) -> None:
super().__init__(message, *args, **kwargs)
self._user_message = user_message
@property
def user_message(self) -> str:
return self._user_message
|