Skip to main content

HTTPException

An HTTP exception you can raise in your own code to show errors to the client.

Attributes

AttributeTypeDescription
status_codeintHTTP status code to send to the client.
detailAny = NoneAny data to be sent to the client in the detail key of the JSON response.
headers`Mapping[str, str]None` = None

Constructor

Signature

def HTTPException(
status_code: int,
detail: Any = None,
headers: Mapping[str, str]| None = None
) - > None

Parameters

NameTypeDescription
status_codeintHTTP status code to send to the client.
detailAny = NoneAny data to be sent to the client in the detail key of the JSON response.
headers`Mapping[str, str]None` = None

Signature

def HTTPException(
status_code: int,
detail: Any = None,
headers: Mapping[str, str]| None = None
) - > null

Parameters

NameTypeDescription
status_codeintHTTP status code to send to the client.
detailAny = NoneAny data to be sent to the client in the detail key of the JSON response.
headers`Mapping[str, str]None` = None