Functions
is_rosettes_available
0
bool
▼
Check if Rosettes syntax highlighter is available.
is_rosettes_available
0
bool
▼
def is_rosettes_available() -> bool
Returns
bool
format_exception_html
6
str
▼
Format an exception as a rich HTML error page.
format_exception_html
6
str
▼
def format_exception_html(exc_type: type[BaseException], exc_value: BaseException, exc_tb: Any, *, request_method: str = 'GET', request_path: str = '/', request_headers: list[tuple[bytes, bytes]] | None = None) -> str
Parameters
| Name | Type | Description |
|---|---|---|
exc_type |
type[BaseException] |
Exception class. |
exc_value |
BaseException |
Exception instance. |
exc_tb |
Any |
Traceback object. |
request_method |
str |
HTTP method for context. Default:'GET'
|
request_path |
str |
Request path for context. Default:'/'
|
request_headers |
list[tuple[bytes, bytes]] | None |
Request headers for context. Default:None
|
Returns
str
_extract_frames
1
list[dict[str, Any]]
▼
Extract frame information from a traceback.
_extract_frames
1
list[dict[str, Any]]
▼
def _extract_frames(tb: Any) -> list[dict[str, Any]]
Parameters
| Name | Type | Description |
|---|---|---|
tb |
Any |
Traceback object. |
Returns
list[dict[str, Any]]
_get_source_context
3
list[tuple[int, str]]
▼
Get source code lines around the given line number.
_get_source_context
3
list[tuple[int, str]]
▼
def _get_source_context(filename: str, lineno: int, context: int = 5) -> list[tuple[int, str]]
Parameters
| Name | Type | Description |
|---|---|---|
filename |
str |
Path to source file. |
lineno |
int |
Line number (1-indexed). |
context |
int |
Number of lines before/after to include. Default:5
|
Returns
list[tuple[int, str]]
_sanitize_locals
1
dict[str, str]
▼
Sanitize local variables for safe display.
Removes sensitive data and formats …
_sanitize_locals
1
dict[str, str]
▼
def _sanitize_locals(local_vars: dict[str, Any]) -> dict[str, str]
Sanitize local variables for safe display.
Removes sensitive data and formats values for display.
Parameters
| Name | Type | Description |
|---|---|---|
local_vars |
dict[str, Any] |
Dictionary of local variables. |
Returns
dict[str, str]
_render_header
4
str
▼
Render the HTML header with exception details.
_render_header
4
str
▼
def _render_header(exc_type: type[BaseException], exc_value: BaseException, method: str, path: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
exc_type |
type[BaseException] |
|
exc_value |
BaseException |
|
method |
str |
|
path |
str |
Returns
str
_render_frame
1
str
▼
Render a single traceback frame as HTML.
_render_frame
1
str
▼
def _render_frame(frame_info: dict[str, Any]) -> str
Parameters
| Name | Type | Description |
|---|---|---|
frame_info |
dict[str, Any] |
Returns
str
_render_request_details
3
str
▼
Render request details section.
_render_request_details
3
str
▼
def _render_request_details(method: str, path: str, headers: list[tuple[bytes, bytes]]) -> str
Parameters
| Name | Type | Description |
|---|---|---|
method |
str |
|
path |
str |
|
headers |
list[tuple[bytes, bytes]] |
Returns
str
_render_footer
0
str
▼
Render HTML footer.
_render_footer
0
str
▼
def _render_footer() -> str
Returns
str
create_debug_error_response
6
tuple[int, list[tuple[by…
▼
Create an HTTP error response with rich traceback.
create_debug_error_response
6
tuple[int, list[tuple[by…
▼
def create_debug_error_response(exc_type: type[BaseException], exc_value: BaseException, exc_tb: Any, *, request_method: str = 'GET', request_path: str = '/', request_headers: list[tuple[bytes, bytes]] | None = None) -> tuple[int, list[tuple[bytes, bytes]], bytes]
Parameters
| Name | Type | Description |
|---|---|---|
exc_type |
type[BaseException] |
Exception class. |
exc_value |
BaseException |
Exception instance. |
exc_tb |
Any |
Traceback object. |
request_method |
str |
HTTP method. Default:'GET'
|
request_path |
str |
Request path. Default:'/'
|
request_headers |
list[tuple[bytes, bytes]] | None |
Request headers. Default:None
|
Returns
tuple[int, list[tuple[bytes, bytes]], bytes]
create_production_error_response
0
tuple[int, list[tuple[by…
▼
Create a simple 500 error response for production.
create_production_error_response
0
tuple[int, list[tuple[by…
▼
def create_production_error_response() -> tuple[int, list[tuple[bytes, bytes]], bytes]
Returns
tuple[int, list[tuple[bytes, bytes]], bytes]