tanjun.errors#
The errors and warnings raised within and by Tanjun.
MissingDependencyError
module-attribute
#
MissingDependencyError = alluka.MissingDependencyError
Type alias of alluka.MissingDependencyError.
CommandError #
Bases: TanjunError
An error which is sent as a response to the command call.
__init__ #
__init__(content=hikari.UNDEFINED, *, delete_after=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED)
Initialise a command error.
PARAMETER | DESCRIPTION |
---|---|
content |
The content to respond with. If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content.
TYPE:
|
delete_after |
If provided, the seconds after which the response message should be deleted. Slash command responses can only be deleted within 15 minutes of the command being received.
TYPE:
|
attachment |
A singular attachment to respond with.
TYPE:
|
attachments |
A sequence of attachments to respond with.
TYPE:
|
component |
If provided, builder object of the component to include in this response.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this response.
TYPE:
|
embed |
An embed to respond with.
TYPE:
|
embeds |
A sequence of embeds to respond with.
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions. |
user_mentions |
If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.
TYPE:
|
role_mentions |
If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
Raised for any of the following reasons:
|
send
async
#
send(ctx, /, *, ensure_result=False)
Send this error as a command response.
PARAMETER | DESCRIPTION |
---|---|
ctx |
The command call context to respond to. |
ensure_result |
Ensure that this call will always return a message object. If True then this will always return hikari.messages.Message,
otherwise this will return It's worth noting that, under certain scenarios within the slash command flow, this may lead to an extre request being made.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
hikari.BadRequestError
|
This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components. |
hikari.UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
hikari.ForbiddenError
|
If you are missing the |
hikari.NotFoundError
|
If the channel is not found. |
hikari.RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
hikari.RateLimitedError
|
Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. |
hikari.InternalServerError
|
If an internal error occurs on Discord while handling the request. |
ConversionError #
Bases: ParserError
Error raised by a parser parameter when it failed to converter a value.
__init__ #
__init__(message, parameter, /, *, errors=())
Initialise a conversion error.
PARAMETER | DESCRIPTION |
---|---|
parameter |
The parameter this was raised by.
TYPE:
|
errors |
An iterable of the source value errors which were raised during conversion.
TYPE:
|
FailedCheck #
Bases: TanjunError
, RuntimeError
Error raised as an alternative to returning False
in a check.
FailedModuleImport #
Bases: FailedModuleLoad
Error raised when a module failed to import.
This is a specialisation of tanjun.errors.FailedModuleLoad.
FailedModuleLoad #
Bases: TanjunError
Error raised when a module fails to load.
This may be raised by the module failing to import or by one of its loaders erroring.
This source error can be accessed at FailedModuleLoad.cause.
FailedModuleUnload #
Bases: TanjunError
Error raised when a module fails to unload.
This may be raised by the module failing to import or by one of its unloaders erroring.
The source error can be accessed at FailedModuleUnload.cause.
HaltExecution #
Bases: TanjunError
Error raised while looking for a command in-order to end-execution early.
For the most part, this will be raised during checks in-order to prevent other commands from being tried.
InvalidCheck #
Bases: TanjunError
, RuntimeError
Error raised as an assertion that a check will never pass in the current environment.
ModuleMissingLoaders #
Bases: RuntimeError
, TanjunError
Error raised when a module is missing loaders.
ModuleMissingUnloaders #
Bases: RuntimeError
, TanjunError
Error raised when a module is missing unloaders.
ModuleStateConflict #
Bases: ValueError
, TanjunError
Error raised when a module cannot be (un)loaded due to a state conflict.
NotEnoughArgumentsError #
Bases: ParserError
Error raised by the parser when not enough arguments are found for a parameter.
ParserError #
Bases: TanjunError
, ValueError
Base error raised by a parser or parameter during parsing.
Note
Expected errors raised by the parser will subclass this error.
TooManyArgumentsError #
Bases: ParserError
Error raised by the parser when too many arguments are found for a parameter.