DiscordLua
discorddiscord
v1.2.4
Install

RuntimeError

Error
On this page

RuntimeError 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

RuntimeError.new(message, extra)

The class table is callable, so RuntimeError(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.RuntimeError({}, {})

Properties

RuntimeError.code

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

RuntimeError.extra

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

RuntimeError.message

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

RuntimeError.method

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

RuntimeError.name

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

RuntimeError.path

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

RuntimeError.retryAfter

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

RuntimeError.status

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

Methods

RuntimeError.new()

# static

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

Signature

RuntimeError.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 RuntimeError
RuntimeError.new(message, extra)

RuntimeError:raise()

#

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

Signature

RuntimeError: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 RuntimeError
object:raise(level)

Examples

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

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

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc