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. This object is passed to ClientOptions.captchaSolver when one is configured. 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

_sanitizeRequestData ​

static · private

_sanitizeRequestData(data: *): *

Sanitizes request data to prevent credential leakage in error logs Parameters

NameTypeDescription
data*Request data object

Returns: * — Sanitized data Source

Unofficial software. Not affiliated with or supported by Discord.