exceptions¶
- exception litestar.exceptions.ClientException[原始碼]¶
基底類別:
HTTPExceptionClient error.
- exception litestar.exceptions.DTOFactoryException[原始碼]¶
基底類別:
LitestarExceptionBase DTO exception type.
- exception litestar.exceptions.HTTPException[原始碼]¶
基底類別:
LitestarExceptionBase exception for HTTP error responses.
These exceptions carry information to construct an HTTP response.
- __init__(*args: Any, detail: str = '', status_code: int | None = None, headers: dict[str, str] | None | Literal[_EmptyEnum.EMPTY] = _EmptyEnum.EMPTY, extra: dict[str, Any] | list[Any] | None | Literal[_EmptyEnum.EMPTY] = _EmptyEnum.EMPTY) None[原始碼]¶
初始化
HTTPException。Set
detailandargsif not provided.- 參數:
*args¶ -- if
detailkwarg not provided, first arg should be error detail.detail¶ -- Exception details or message. Will default to args[0] if not provided.
status_code¶ -- Exception HTTP status code.
headers¶ -- Headers to set on the response. Defaults to the class's
headersif not provided. Set toNoneexplicitly to unset the default.extra¶ -- An extra mapping to attach to the exception. Defaults to the class's
extraif not provided. Set toNoneexplicitly to unset the default.
- exception litestar.exceptions.ImproperlyConfiguredException[原始碼]¶
基底類別:
HTTPException,ValueErrorApplication has improper configuration.
- exception litestar.exceptions.InternalServerException[原始碼]¶
基底類別:
HTTPExceptionServer encountered an unexpected condition that prevented it from fulfilling the request.
- exception litestar.exceptions.InvalidAnnotationException[原始碼]¶
基底類別:
DTOFactoryExceptionUnexpected DTO type argument.
- exception litestar.exceptions.LitestarException[原始碼]¶
基底類別:
ExceptionBase exception class from which all Litestar exceptions inherit.
- exception litestar.exceptions.LitestarWarning[原始碼]¶
基底類別:
UserWarningBase class for Litestar warnings
- exception litestar.exceptions.MethodNotAllowedException[原始碼]¶
基底類別:
ClientExceptionServer knows the request method, but the target resource doesn't support this method.
- exception litestar.exceptions.MissingDependencyException[原始碼]¶
基底類別:
LitestarException,ImportErrorMissing optional dependency.
This exception is raised only when a module depends on a dependency that has not been installed.
- exception litestar.exceptions.NoRouteMatchFoundException[原始碼]¶
-
A route with the given name could not be found.
- exception litestar.exceptions.NotAuthorizedException[原始碼]¶
基底類別:
ClientExceptionRequest lacks valid authentication credentials for the requested resource.
- exception litestar.exceptions.NotFoundException[原始碼]¶
基底類別:
ClientException,ValueErrorCannot find the requested resource.
- exception litestar.exceptions.PermissionDeniedException[原始碼]¶
基底類別:
ClientExceptionRequest understood, but not authorized.
- exception litestar.exceptions.SerializationException[原始碼]¶
基底類別:
LitestarExceptionEncoding or decoding of an object failed.
-
Server is not ready to handle the request.
Exception status code.
- exception litestar.exceptions.TemplateNotFoundException[原始碼]¶
-
Referenced template could not be found.
- exception litestar.exceptions.TooManyRequestsException[原始碼]¶
基底類別:
ClientExceptionRequest limits have been exceeded.
- exception litestar.exceptions.ValidationException[原始碼]¶
基底類別:
ClientException,ValueErrorClient data validation error.
- exception litestar.exceptions.WebSocketDisconnect[原始碼]¶
基底類別:
WebSocketExceptionException class for websocket disconnect events.
- exception litestar.exceptions.WebSocketException[原始碼]¶
基底類別:
LitestarExceptionException class for websocket related events.
- class litestar.exceptions.responses.ExceptionResponseContent[原始碼]¶
基底類別:
objectRepresent the contents of an exception-response.
- litestar.exceptions.responses.create_debug_response(request: Request, exc: Exception) Response[原始碼]¶
Create a debug response from an exception.
- litestar.exceptions.responses.create_exception_response(request: Request[Any, Any, Any], exc: Exception) Response[原始碼]¶
Construct a response from an exception.
備註
For instances of
HTTPExceptionor other exception classes that have astatus_codeattribute (e.g. Starlette exceptions), the status code is drawn from the exception, otherwise response status isHTTP_500_INTERNAL_SERVER_ERROR.