Skip to content

error_handlers

Methods to handle and raise HTTP errors.

raise_http_internal_error(ex)

Handles an error as an internal error, raising proper exception.

Source code in mlte/backend/api/error_handlers.py
12
13
14
15
16
17
18
19
def raise_http_internal_error(ex: Exception) -> typing.NoReturn:
    """Handles an error as an internal error, raising proper exception."""
    logging.error(f"Internal server error. {ex}")
    logging.error(tb.format_exc())
    raise HTTPException(
        status_code=codes.INTERNAL_ERROR,
        detail="Internal server error.",
    )