Exceptions
exceptions
¶
PokeLanceException
¶
Bases: Exception
Base exception class for PokeLance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The message to display. |
required |
route
|
Route
|
The route that caused the exception. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
message |
str
|
The message to display. |
route |
Route
|
The route that caused the exception. |
Source code in pokelance/exceptions.py
HTTPException
¶
Bases: PokeLanceException
Base exception class for HTTP exceptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The message to display. |
required |
route
|
Route
|
The route that caused the exception. |
required |
status
|
int
|
The status code of the exception. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
message |
str
|
The message to display. |
route |
Route
|
The route that caused the exception. |
status |
int
|
The status code of the exception. |
Source code in pokelance/exceptions.py
create
¶
create() -> HTTPException
BadRequest
¶
Bases: HTTPException
Exception raised when a bad request is made. [HTTP 400]
Source code in pokelance/exceptions.py
Unauthorized
¶
Bases: HTTPException
Exception raised when unauthorized. [HTTP 401]
Source code in pokelance/exceptions.py
Forbidden
¶
Bases: HTTPException
Exception raised when forbidden. [HTTP 403]
Source code in pokelance/exceptions.py
NotFound
¶
Bases: HTTPException
Exception raised when a resource is not found. [HTTP 404]
Source code in pokelance/exceptions.py
MethodNotAllowed
¶
Bases: HTTPException
Exception raised when a method is not allowed. [HTTP 405]
Source code in pokelance/exceptions.py
UnknownError
¶
Bases: HTTPException
Exception raised when an unknown error occurs.
Source code in pokelance/exceptions.py
ResourceNotFound
¶
Bases: NotFound
Exception raised when a resource is not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The message to display. |
required |
route
|
Route
|
The route that caused the exception. |
required |
status
|
int
|
The status code of the exception. |
required |
suggestions
|
list[str] | None
|
Possible suggestions for the resource. |
None
|
Source code in pokelance/exceptions.py
ImageNotFound
¶
AudioNotFound
¶
get_exception
¶
get_exception(status: int) -> type[HTTPException]
Gets an exception from the status code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
int
|
The status code. |
required |
Returns:
| Type | Description |
|---|---|
HTTPException
|
The exception. |