Module spangle.exceptions¶
spangle
exceptions.
Classes¶
MethodNotAllowedError¶
class MethodNotAllowedError(
self,
message="Method not allowed.",
status=HTTPStatus.METHOD_NOT_ALLOWED,
allowed_methods: Optional[set[str]] = None,)
405: Unexpected method. Safe methods like GET
will be accepted anytime.
Args
- message (
str
): Print on error page. - status (
int
): HTTP status code. - headers (
dict[str, str]
): HTTP headers.
Base classes¶
NotFoundError¶
class NotFoundError(self, message="Content not found.", status=HTTPStatus.NOT_FOUND)
404: Missing resources, views, etc.
Args
- message (
str
): Print on error page. - status (
int
): HTTP status code. - headers (
dict[str, str]
): HTTP headers.
Base classes¶
ParseError¶
class ParseError(self, message="Unsupported format.", status=HTTPStatus.BAD_REQUEST)
400: Raised by parser.
Args
- message (
str
): Print on error page. - status (
int
): HTTP status code. - headers (
dict[str, str]
): HTTP headers.
Base classes¶
SpangleError
builtins.ValueError
SpangleError¶
class SpangleError(
self,
message="Something wrong.",
status=HTTPStatus.INTERNAL_SERVER_ERROR,
headers: Optional[dict[str, str]] = None,)
500: Base class of spangle-errors.
Args
- message (
str
): Print on error page. - status (
int
): HTTP status code. - headers (
dict[str, str]
): HTTP headers.
Base classes¶
builtins.Exception
TooLargeRequestError¶
class TooLargeRequestError(self, message="Payload too large.", status=HTTPStatus.REQUEST_ENTITY_TOO_LARGE)
413: Payload Too Large.
Args
- message (
str
): Print on error page. - status (
int
): HTTP status code. - headers (
dict[str, str]
): HTTP headers.