You are reading the documentation for the next version of discord.js. Documentation for v13/v14+ has been moved to old.discordjs.dev

DiscordAPIError

export declare class DiscordAPIError extends Error
export declare class DiscordAPIError extends Error
Represents an API error returned by Discord

Extends

Error
constructor(rawError, code, status, method, url, bodyData)
Constructs a new instance of the DiscordAPIError class
NameTypeOptionalDescription
rawErrorDiscordErrorData | OAuthErrorDataNoThe error reported by Discord
codenumber | stringNoThe error code reported by Discord
statusnumberNoThe status code of the response
methodstringNoThe method of the request that erred
urlstringNoThe url of the request that erred
bodyDataPick<InternalRequest, 'body' | 'files'>NoThe unparsed data for the request that errored
code:number | string
method:string
Readonly
name:string
The name of the error
requestBody:RequestBody
status:number
url:string