22 lines
553 B
Python
22 lines
553 B
Python
from typing import ClassVar
|
|
|
|
|
|
class GenericError(Exception):
|
|
"""Base class for every GENERIC error the API can explain to a client."""
|
|
status_code: ClassVar[int] = 502
|
|
code: ClassVar[str] = "sm_upstream_error"
|
|
client_visible: ClassVar[bool] = False
|
|
|
|
@property
|
|
def client_message(self) -> str:
|
|
return str(self) if self.client_visible else "The GENERIC entry could not be checked right now, please try again later"
|
|
@property
|
|
def headers(self) -> dict[str, str]:
|
|
"""Extra HTTP headers the proxy should send with this error."""
|
|
return {}
|
|
|
|
|
|
|
|
|
|
|