Skip to content

DiscordAPIError

classe · Source

Represents an error from the Discord API.

Extends: Error

Properties

method

method: string

The HTTP method used for the request Source

path

path: string

The path of the request relative to the HTTP endpoint Source

code

code: number

HTTP error code returned by Discord Source

httpStatus

httpStatus: number

The HTTP status code Source

requestData

requestData: HTTPErrorData

The data associated with the request that caused this error Source

retries

retries: number

The number of times this request has been retried Source

captcha

captcha: Captcha | null

Captcha response data if the request requires a captcha Source

isBlockedByCloudflare

isBlockedByCloudflare: boolean

A special 40333 JSON error code is returned if your request is blocked by Cloudflare. This may be due to a malformed request or improper user agent. The response resembles a normal error structure: Source

Methods

flattenErrors

static · private

flattenErrors(obj: APIError, key?: string): Array<string>

Flattens an errors object returned from the API into an array. Parameters

NameTypeDescription
objAPIErrorDiscord errors object
key?stringUsed internally to determine key names of nested fields

Returns: Array<string>Source

Unofficial software. Not affiliated with or supported by Discord.