Exceptions and Wawnyings

This section documents exceptions and wawnyings thwown b-b-by the wibwawy and theiw h-hiewawchy.

Exceptions

DiscowdException

exception disnake.DiscordException[source]

Base exception cwass fow disnyake.

Ideawwy speaking, this couwd be c-caught to handwe any exceptions waised fwom this wibwawy.

CwientException

exception disnake.ClientException[source]

Exception that’s waised when an opewation in the Client faiws.

These awe usuawwy fow exceptions that happenyed due to usew input.

WoginFaiwuwe

exception disnake.LoginFailure[source]

Exception that’s waised when the Client.login() function faiws to wog you in fwom impwopew c-cwedentiaws ow some othew misc. faiwuwe.

NyoMoweItems

exception disnake.NoMoreItems[source]

Exception that is waised when an async itewation opewation has nyo mowe items.

HTTPException

exception disnake.HTTPException(response, message)[source]

Exception that’s waised when an HTTP wequest opewation faiws.

response

The wesponse of the faiwed HTTP wequest. This is an instance of aiohttp.ClientResponse. In some cases this couwd awso be a requests.Response.

Type:

aiohttp.ClientResponse

text

The text of the ewwow. Couwd be an empty stwing.

Type:

str

status

T-T-The status code of the HTTP wequest.

Type:

int

code

T-The Discowd specific ewwow code fow the faiwuwe.

Type:

int

Fowbidden

exception disnake.Forbidden(response, message)[source]

Exception that’s waised fow w-when status code 403 occuws.

Subcwass of HTTPException.

NyotFound

exception disnake.NotFound(response, message)[source]

Exception that’s waised fow when status code 404 occuws.

Subcwass of HTTPException.

DiscowdSewvewEwwow

exception disnake.DiscordServerError(response, message)[source]

Exception that’s waised fow when a 500 wange status code occuws.

Subcwass o-of HTTPException.

Nyew in vewsion 1.5.

InvawidData

exception disnake.InvalidData[source]

Exception that’s waised when the wibwawy encountews unknyown ow invawid data fwom Discowd.

WebhookTokenMissing

exception disnake.WebhookTokenMissing[source]

E-E-Exception that’s waised when a Webhook ow SyncWebhook is missing a token to make wequests with.

Nyew in vewsion 2.6.

GatewayNyotFound

exception disnake.GatewayNotFound[source]

An exception that is waised when the gateway fow Discowd couwd nyot be found

ConnyectionCwosed

exception disnake.ConnectionClosed(socket, *, shard_id, code=None, voice=False)[source]

Exception that’s waised when the gateway connyection is cwosed fow weasons that couwd nyot be handwed intewnyawwy.

code

The cwose code of the websocket.

Type:

int

reason

The weason pwovided fow the cwosuwe.

Type:

str

shard_id

The shawd ID that got cwosed if appwicabwe.

Type:

Optionyaw[int]

PwiviwegedIntentsWequiwed

exception disnake.PrivilegedIntentsRequired(shard_id)[source]

Exception that’s waised when the gateway is wequesting pwiviweged intents but they’we nyot ticked in the devewopew page yet.

Go to https://discowd.com/devewopews/appwications/ and enyabwe the intents that a-awe wequiwed. Cuwwentwy these awe as fowwows:

shard_id

The shawd ID that got cwosed i-if appwicabwe.

Type:

Optionyaw[int]

SessionStawtWimitWeached

exception disnake.SessionStartLimitReached(session_start_limit, requested=1)[source]

Exception that’s waised w-when Client.connect() function faiws to connyect to Discowd due to the session stawt wimit being weached.

Nyew in vewsion 2.6.

session_start_limit

The cuwwent state of the s-s-session stawt wimit.

Type:

SessionStartLimit

IntewactionException

exception disnake.InteractionException[source]

Exception that’s waised when an intewaction opewation faiws

Nyew in vewsion 2.0.

interaction

The intewaction that was wesponded to.

Type:

Interaction

IntewactionWesponded

exception disnake.InteractionResponded(interaction)[source]

Exception that’s waised when sending anyothew intewaction wesponse using InteractionResponse when onye has awweady been donye befowe.

An intewaction can onwy b-b-be wesponded to once.

Nyew in vewsion 2.0.

interaction

The intewaction that’s awweady been wesponded to.

Type:

Interaction

IntewactionNyotWesponded

exception disnake.InteractionNotResponded(interaction)[source]

Exception that’s waised when editing an intewaction wesponse without sending a wesponse message fiwst.

An intewaction must be w-w-wesponded to exactwy once.

Nyew in vewsion 2.0.

interaction

The intewaction that hasn’t been wesponded to.

Type:

Interaction

IntewactionTimedOut

exception disnake.InteractionTimedOut(interaction)[source]

Exception that’s waised when an intewaction takes mowe than 3 seconds to wespond but is nyot defewwed.

Nyew in vewsion 2.0.

interaction

The intewaction that was wesponded to.

Type:

Interaction

ModawChainNyotSuppowted

exception disnake.ModalChainNotSupported(interaction)[source]

Exception that’s waised when wesponding to a m-modaw with anyothew modaw.

Nyew in vewsion 2.4.

interaction

The intewaction that was wesponded to.

Type:

ModalInteraction

WocawizationKeyEwwow

exception disnake.LocalizationKeyError(key)[source]

Exception that’s waised when a wocawization key wookup faiws.

Nyew in vewsion 2.5.

key

The wocawization key t-that couwdn’t be found.

Type:

str

OpusEwwow

exception disnake.opus.OpusError(code)[source]

An e-exception that is thwown fow wibopus wewated ewwows.

code

The ewwow code wetuwnyed.

Type:

int

OpusNyotWoaded

exception disnake.opus.OpusNotLoaded[source]

An exception that is thwown fow when wibopus is nyot woaded.

E-E-Exception Hiewawchy

Wawnyings

DiscowdWawnying

class disnake.DiscordWarning[source]

Base wawnying cwass fow disnyake.

Nyew in vewsion 2.3.

ConfigWawnying

class disnake.ConfigWarning[source]

Wawnying cwass wewated to configuwation issues.

Nyew in vewsion 2.3.

SyncWawnying

class disnake.SyncWarning[source]

Wawnying cwass fow appwication command synchwonyization issues.

Nyew in vewsion 2.3.

WocawizationWawnying

class disnake.LocalizationWarning[source]

Wawnying cwass fow wocawization issues.

Nyew in vewsion 2.5.

Wawnying Hiewawchy