Buckets:

download
raw
873 Bytes
"""Customize error pages."""
from collections.abc import Callable
from typing import Any
from fastlife.adapters.tamahagane import RegistryHub, th_attach
def exception_handler(
exception: type[Exception],
*,
status_code: int | None = None,
) -> Callable[..., Any]:
"""
A decorator function to add an exception handler in the app.
:param methods: restrict route to a list of http methods.
:return: the configuration callback.
"""
def configure(wrapped: Callable[..., Any]) -> Callable[..., Any]:
def callback(registry: RegistryHub) -> None:
registry.fastlife.add_exception_handler(
exception,
wrapped,
**({} if status_code is None else {"status_code": status_code}),
)
th_attach(wrapped, callback)
return wrapped
return configure

Xet Storage Details

Size:
873 Bytes
·
Xet hash:
056f9ca5dccfbc9a98ef4f7bd45c66d9d6ddf9845f420885cdafc1b35a1123d2

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.