hikari.errors#
Exceptions and warnings that can be thrown by this library.
Module Contents#
- exception hikari.errors.BadRequestError[source]#
Bases:
ClientHTTPResponseError
Raised when you send an invalid request somehow.
- errors: Optional[Mapping[str, hikari.internal.data_binding.JSONObject]][source]#
Dict of top level field names to field specific error paths.
For more information, this error format is loosely defined at <https://discord.com/developers/docs/reference#error-messages> and is commonly returned for 50035 errors.
- status: http.HTTPStatus[source]#
The HTTP status code for the response.
- exception hikari.errors.BulkDeleteError[source]#
Bases:
HikariError
Exception raised when a bulk delete fails midway through a call.
This will contain the list of message items that failed to be deleted, and will have a cause containing the initial exception.
- deleted_messages: hikari.snowflakes.SnowflakeishSequence[hikari.messages.PartialMessage][source]#
Any message objects that were deleted before an exception occurred.
- exception hikari.errors.ClientHTTPResponseError[source]#
Bases:
HTTPResponseError
Base exception for an erroneous HTTP response that is a client error.
All exceptions derived from this base should be treated as 4xx client errors when encountered.
- exception hikari.errors.ComponentStateConflictError[source]#
Bases:
HikariError
Exception thrown when an action cannot be executed in the component’s current state.
Dependent on context this will be thrown for components which are already running or haven’t been started yet.
- exception hikari.errors.ForbiddenError[source]#
Bases:
ClientHTTPResponseError
Raised when you are not allowed to access a specific resource.
This means you lack the permissions to do something, either because of permissions set in a guild, or because your application is not whitelisted to use a specific endpoint.
- status: http.HTTPStatus[source]#
The HTTP status code for the response.
- exception hikari.errors.GatewayConnectionError[source]#
Bases:
GatewayError
An exception thrown if a connection issue occurs.
- exception hikari.errors.GatewayError[source]#
Bases:
HikariError
A base exception type for anything that can be thrown by the Gateway.
- exception hikari.errors.GatewayServerClosedConnectionError[source]#
Bases:
GatewayError
An exception raised when the server closes the connection.
- can_reconnect: bool[source]#
Return
True
if we can recover from this closure.If
True
, it will try to reconnect after this is raised rather than it being propagated to the caller. IfFalse
, this will be raised, thus stopping the application unless handled explicitly by the user.
- code: Union[ShardCloseCode, int, None][source]#
Return the close code that was received, if there is one.
- exception hikari.errors.HTTPError[source]#
Bases:
HikariError
Base exception raised if an HTTP error occurs while making a request.
- exception hikari.errors.HTTPResponseError[source]#
Bases:
HTTPError
Base exception for an erroneous HTTP response.
- status: Union[http.HTTPStatus, int][source]#
The HTTP status code for the response.
This will be
int
if it’s outside the range of status codes in the HTTP specification (e.g. one of Cloudflare’s non-standard status codes).
- exception hikari.errors.HikariError[source]#
Bases:
RuntimeError
Base for an error raised by this API.
Any exceptions should derive from this.
Note
You should never initialize this exception directly.
- exception hikari.errors.HikariInterrupt[source]#
Bases:
KeyboardInterrupt
,HikariError
Exception raised when a kill signal is handled internally.
- exception hikari.errors.HikariWarning[source]#
Bases:
RuntimeWarning
Base for a warning raised by this API.
Any warnings should derive from this.
Note
You should never initialize this warning directly.
- exception hikari.errors.InternalServerError[source]#
Bases:
HTTPResponseError
Base exception for an erroneous HTTP response that is a server error.
All exceptions derived from this base should be treated as 5xx server errors when encountered. If you get one of these, it is not your fault!
- exception hikari.errors.MissingIntentError[source]#
Bases:
HikariError
,ValueError
Error raised when you try to perform an action without an intent.
This is usually raised when querying the cache for something that is unavailable due to certain intents being disabled.
- intents: hikari.intents.Intents[source]#
The combination of intents that are missing.
- exception hikari.errors.MissingIntentWarning[source]#
Bases:
HikariWarning
Warning raised when subscribing to an event that cannot be fired.
This is caused by your application missing certain intents.
- exception hikari.errors.NotFoundError[source]#
Bases:
ClientHTTPResponseError
Raised when something is not found.
- status: http.HTTPStatus[source]#
The HTTP status code for the response.
- exception hikari.errors.RateLimitTooLongError[source]#
Bases:
HTTPError
Internal error raised if the wait for a rate limit is too long.
This is similar to
asyncio.TimeoutError
in the way that it is used, but this will be raised pre-emptively and immediately if the period of time needed to wait is greater than a user-defined limit.This will almost always be route-specific. If you receive this, it is unlikely that performing the same call for a different channel/guild/user will also have this rate limit.
- property remaining: Literal[0][source]#
Remaining requests in this window.
This will always be
0
symbolically.
- max_retry_after: float[source]#
How long the client is allowed to wait for at a maximum before raising.
- route: hikari.internal.routes.CompiledRoute[source]#
The route that produced this error.
- exception hikari.errors.RateLimitedError[source]#
Bases:
ClientHTTPResponseError
Raised when a non-global rate limit that cannot be handled occurs.
If you receive one of these, you should NOT try again until the given time has passed, either discarding the operation you performed, or waiting until the given time has passed first. Note that it may still be valid to send requests with different attributes in them.
A use case for this by Discord appears to be to stop abuse from bots that change channel names, etc, regularly. This kind of action allegedly causes a fair amount of overhead internally for Discord. In the case you encounter this, you may be able to send different requests that manipulate the same entities (in this case editing the same channel) that do not use the same collection of attributes as the previous request.
- retry_after: float[source]#
How many seconds to wait before you can reuse the route with the specific request.
- route: hikari.internal.routes.CompiledRoute[source]#
The route that produced this error.
- status: http.HTTPStatus[source]#
The HTTP status code for the response.
- exception hikari.errors.UnauthorizedError[source]#
Bases:
ClientHTTPResponseError
Raised when you are not authorized to access a specific resource.
- status: http.HTTPStatus[source]#
The HTTP status code for the response.
- exception hikari.errors.UnrecognisedEntityError[source]#
Bases:
HikariError
An exception thrown when an unrecognised entity is found.
- exception hikari.errors.VoiceError[source]#
Bases:
HikariError
Error raised when a problem occurs with the voice subsystem.