Exceptions

class twitchio.TwitchioException

Base exception for TwitchIO.

All custom TwitchIO exceptions inherit from this class.

class twitchio.HTTPException

Exception raised when an HTTP request fails.

This exception can be raised anywhere the twitchio.Client or twitchio.ext.commands.Bot is used to make a HTTP request to the Twitch API.

route

An optional twitchio.Route supplied to this exception, which contains various information about the request.

Type

twitchio.Route | None

status

The HTTP response code received from Twitch. E.g. 404 or 409.

Type

int

extra

A dict with a single key named “message”, which may contain additional information from Twitch about why the request failed.

Type

dict[Literal[“message”], str]

class twitchio.InvalidTokenException

Exception raised when an token can not be validated or refreshed.

This exception inherits from HTTPException and contains additional information.

Warning

This exception may contain sensitive information.

token

The token which failed to be validated or refreshed. Could be None.

Type

str | None

refresh

The refresh token used to attempt refreshing the token. Could be None.

Type

str | None

route

An optional twitchio.Route supplied to this exception, which contains various information about the request.

Type

twitchio.Route | None

status

The HTTP response code received from Twitch. E.g. 404 or 409.

Type

int

extra

A dict with a single key named “message”, which may contain additional information from Twitch about why the request failed.

Type

dict[Literal[“message”], str]

class twitchio.MessageRejectedError

Exception raised when Twitch rejects a sent message. This is not the same as a HTTPException which is raised when the request fails for a reason.

channel

The the channel the message was attempted to be sent to.

Type

PartialUser

code

The drop code Twitch responded with.

Type

str | None

message

The message Twitch responded with, with the reason why the message was rejected.

Type

str | None

content

The content of the original message sent.

Type

str

Exception Hierarchy