PermissionError
ErrorOn this page
PermissionError 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
PermissionError.new(message, extra) The class table is callable, so PermissionError(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.PermissionError({}, {})Properties
- Name
code- Type
number- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
- Name
extra- Type
table- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
- Name
message- Type
string- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
- Name
method- Type
string- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
- Name
name- Type
string- Access
- readonly
- Description
- Display name of this PermissionError.
- Availability
- Populated from the Gateway/REST payload or constructor for this PermissionError.
- Name
path- Type
string- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
- Name
retryAfter- Type
number- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
- Name
status- Type
number- Access
- readonly
- Description
- Instance field
PermissionError.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 PermissionError.
Methods
Performs new on this PermissionError. Call it from bot code when you need that operation on the current object.
Signature
PermissionError.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 PermissionError
PermissionError.new(message, extra)PermissionError:raise()
#Performs raise on this PermissionError. Call it from bot code when you need that operation on the current object.
Signature
PermissionError: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 PermissionError
object:raise(level)Examples
local discord = require("discord")
local object = discord.PermissionError({})Related APIs
APIError · AuthenticationError · DiscordLuaError · GatewayError · HTTPError · RateLimitError · RuntimeError · ValidationError
Version: discord 1.2.4 · runtime 1.0.0