Files
Ayzee Patton 26bb2e254f Add data templating to generic_error. Bump version patch number.
Data templating is now possible with `generic_error` in a way that does
not break compatibility. May add a readme update in the future to
specify new behavior.

Signed-off-by: Ayzee Patton <vlpatton@vlpatton.gay>
2024-11-06 13:37:22 -06:00

25 lines
836 B
Python

from typing import Optional
class FastAPIChameleonException(Exception):
pass
class FastAPIChameleonNotFoundException(FastAPIChameleonException):
def __init__(self, message: Optional[str] = None, four04template_file: str = 'errors/404.pt'):
super().__init__(message)
self.template_file: str = four04template_file
self.message: Optional[str] = message
class FastAPIChameleonGenericException(FastAPIChameleonException):
def __init__(self, template_file: str, status_code: int,
message: Optional[str] = None, template_data: Optional[dict] = None):
super().__init__(message)
self.template_file: str = template_file
self.status_code: int = status_code
self.message: Optional[str] = message
self.template_data: Optional[dict] = template_data