DiscordjsError
ErrorOn this page
DiscordjsError is raised or passed to a REST callback when an operation fails. Read name and message; REST errors may also expose HTTP status and Discord error codes.
Constructor
DiscordjsError.new(message, extra) The class table is callable, so DiscordjsError(message, extra) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
message |
any |
required | Passed through to the implementation as written. |
extra |
any |
optional | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.DiscordjsError({}, {})Properties
- Name
code- Type
number- Access
- readonly
- Description
- Instance field
DiscordjsError.code. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
extra- Type
table- Access
- readonly
- Description
- Instance field
DiscordjsError.extra. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
message- Type
string- Access
- readonly
- Description
- Instance field
DiscordjsError.message. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
method- Type
string- Access
- readonly
- Description
- Instance field
DiscordjsError.method. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
name- Type
string- Access
- readonly
- Description
- Display name of this DiscordjsError.
- Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
path- Type
string- Access
- readonly
- Description
- Instance field
DiscordjsError.path. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
retryAfter- Type
number- Access
- readonly
- Description
- Instance field
DiscordjsError.retryAfter. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
- Name
status- Type
number- Access
- readonly
- Description
- Instance field
DiscordjsError.status. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this DiscordjsError.
Methods
Performs new on this DiscordjsError. Call it from bot code when you need that operation on the current object.
Signature
DiscordjsError.new(message, extra) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
message |
any |
required | Passed through to the implementation as written. |
extra |
any |
optional | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a DiscordjsError
DiscordjsError.new(message, extra)DiscordjsError:raise()
#Performs raise on this DiscordjsError. Call it from bot code when you need that operation on the current object.
Signature
DiscordjsError:raise(level) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
level |
any |
required | Passed through to the implementation as written. |
Returns
any.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a DiscordjsError
object:raise(level)Examples
local discord = require("discord")
local object = discord.DiscordjsError({})Related APIs
AuthenticationError · DiscordAPIError · DiscordjsRangeError · DiscordjsTypeError · DiscordLuaError · GatewayError · GatewayRateLimitError · HTTPError
Version: discord 1.2.9 · runtime 1.0.0