Skip to content

Exception

Custom Exceptions for Hestia Application.

This module provides custom exception classes for the Hestia application. These exceptions can be used to handle specific error cases and return appropriate HTTP responses.

Classes: - HestiaException: Custom exception class for Hestia application.

HestiaException

Bases: HTTPException

Custom exception class for Hestia application.

This class inherits from FastAPI's HTTPException and allows you to define custom exceptions with a specific detail message and status code.

Parameters:

Name Type Description Default
detail str

The detail message of the exception.

required
status_code int

The status code of the exception (default: 500 Internal Server Error).

status.HTTP_500_INTERNAL_SERVER_ERROR
Source code in hestia/web/exception.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class HestiaException(HTTPException):
    """
    Custom exception class for Hestia application.

    This class inherits from FastAPI's `HTTPException` and allows you to define custom exceptions
    with a specific detail message and status code.

    :param detail: The detail message of the exception.
    :param status_code: The status code of the exception (default: 500 Internal Server Error).
    """

    def __init__(
        self, detail: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR
    ):
        super().__init__(status_code=status_code, detail=detail)