Skip to content
Classcorev0.10.0

Fault

A generic fault you throw after catching an error you do not have a specific message for.

The user sees a fixed generic reply with the tracking uuid, never the cause. report defaults to true, so the framework logs it and publishes it to the handledException bus. Pass report: false to show the generic reply without the bus publish. The original error is stored as the standard cause, so the real stack reaches the webhook. When the user should see a real message for a fault, subclass Notice and write your own render instead.

The framework also renders this for an unhandled throw, where it points the user at ctx.developerUsername.

class Fault extends Notice

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the Fault class

Fault(options?: {
    cause?: unknown;
    report?: boolean;
})

Showing members with Protected visibility and higher.

ephemeral

Whether the reply is ephemeral, seen only by the invoking user. Set it false for a refusal the whole channel should see.

ephemeral: boolean;

Inherited from:Notice

Default:true

report

Whether this denial is a reported fault. True also logs it and publishes it to the handledException bus. The user always sees render either way.

report: boolean;

Inherited from:Notice

Default:false

summary

A short one-line reason. When every arm of an or gate refuses and each one sets this, or throws a refusal listing them under You need to meet at least one of these:. Write a verb phrase that finishes that line, for example, "be the bot owner".

summary?: string

Inherited from:Notice