DiscordLua
discorddiscord
v1.2.4
Install

DiscordLuaError

Error
On this page

DiscordLuaError 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.

error Module 1.2.4 Source

Constructor

DiscordLuaError.new(message, extra)

The class table is callable, so DiscordLuaError(message, extra) is the same as .new.

NameTypeRequiredBehavior
message any required Passed through to the implementation as written.
extra any optional Passed through to the implementation as written.
lua
local discord = require("discord")
local object = discord.DiscordLuaError({}, {})

Properties

DiscordLuaError.code

# readonly
Name
code
Type
number
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

DiscordLuaError.extra

# readonly
Name
extra
Type
table
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

DiscordLuaError.message

# readonly
Name
message
Type
string
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

DiscordLuaError.method

# readonly
Name
method
Type
string
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

DiscordLuaError.name

# readonly
Name
name
Type
string
Access
readonly
Description
Display name of this DiscordLuaError.
Availability
Populated from the Gateway/REST payload or constructor for this DiscordLuaError.

DiscordLuaError.path

# readonly
Name
path
Type
string
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

DiscordLuaError.retryAfter

# readonly
Name
retryAfter
Type
number
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

DiscordLuaError.status

# readonly
Name
status
Type
number
Access
readonly
Description
Instance field DiscordLuaError.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 DiscordLuaError.

Methods

DiscordLuaError.new()

# static

Performs new on this DiscordLuaError. Call it from bot code when you need that operation on the current object.

Signature

DiscordLuaError.new(message, extra)

Parameters

NameTypeRequiredBehavior
message any required Passed through to the implementation as written.
extra any optional Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a DiscordLuaError
DiscordLuaError.new(message, extra)

DiscordLuaError:raise()

#

Performs raise on this DiscordLuaError. Call it from bot code when you need that operation on the current object.

Signature

DiscordLuaError:raise(level)

Parameters

NameTypeRequiredBehavior
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

lua
local discord = require("discord")
-- object is a DiscordLuaError
object:raise(level)

Examples

lua
local discord = require("discord")
local object = discord.DiscordLuaError({})

APIError · AuthenticationError · GatewayError · HTTPError · PermissionError · RateLimitError · RuntimeError · ValidationError

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc