ErrorHandler

export declare class ErrorHandler

Constructor

constructor(client: IgloClient): this;

Paramaters

nametypeoptionaldescription
clientIgloClientNo-

Properties

client: IgloClient

ignoredCodes: Array<RESTJSONErrorCodes>

Methods

handleError(error, interaction?)

function handleError(error: Error, interaction?: Interaction): Promise<void>

Paramaters

nametypeoptionaldescription
errorErrorNoThe error that was emitted
interactionInteractionYesThe interaction from the user that used the bot

Description

Logs the error and makes sure the user is aware of the situation. This function is overridable for customisability.

isDirectinteractionReplyAfterBlock(channelId, guild, error)

protected
function isDirectinteractionReplyAfterBlock(channelId: string, guild: "null" | string, error: DiscordAPIError): boolean

Paramaters

nametypeoptionaldescription
channelIdstringNothe id of the channel the error came from
guildnull | stringNothe guild id the error came from
errorDiscordAPIErrorNothe Discord API Error that was returned after the request

Description

Checks if the error has something to do with replying to a blocked user or blocked channel

isSilencedError(channelId, guild, error)

protected
function isSilencedError(channelId: string, guild: "null" | string, error: DiscordAPIError): boolean

Paramaters

nametypeoptionaldescription
channelIdstringNothe id of the channel the error came from
guildnull | stringNothe guild id the error came from
errorDiscordAPIErrorNothe Discord API Error that was returned after the request

Description

Checks if the Discord API Error is worth logging