MCPcopy
hub / github.com/encode/starlette / HTTPException

Class HTTPException

starlette/exceptions.py:7–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7class HTTPException(Exception):
8 def __init__(self, status_code: int, detail: str | None = None, headers: Mapping[str, str] | None = None) -> None:
9 if detail is None:
10 detail = http.HTTPStatus(status_code).phrase
11 self.status_code = status_code
12 self.detail = detail
13 self.headers = headers
14
15 def __str__(self) -> str:
16 return f"{self.status_code}: {self.detail}"
17
18 def __repr__(self) -> str:
19 class_name = self.__class__.__name__
20 return f"{class_name}(status_code={self.status_code!r}, detail={self.detail!r})"
21
22
23class WebSocketException(Exception):

Callers 15

get_responseMethod · 0.90
method_not_allowedMethod · 0.90
_get_formMethod · 0.90
async_wrapperFunction · 0.90
sync_wrapperFunction · 0.90
handleMethod · 0.90
not_foundMethod · 0.90
not_acceptableFunction · 0.90
no_contentFunction · 0.90
not_modifiedFunction · 0.90
with_headersFunction · 0.90

Calls

no outgoing calls

Tested by 9

not_acceptableFunction · 0.72
no_contentFunction · 0.72
not_modifiedFunction · 0.72
with_headersFunction · 0.72
__call__Method · 0.72
test_http_strFunction · 0.72
test_http_reprFunction · 0.72
excFunction · 0.72