Skip to content
GitHub

CooldownStoreError

class in meocord/common Since 4.1.0

class CooldownStoreError extends Error

Thrown when the cooldown store fails and @MeoCord({ cooldownStoreFailure }) is 'deny', its default.

Catch it in a filter to word the refusal your own way, or in the user's language. Without one, the built-in fallback answers only the caller, with cooldownStoreMessage. A message command is not answered, unless messages.dmOnError tells its author in a direct message, once per outage.

Examples

TypeScript
@Catch(CooldownStoreError)
export class CooldownStoreFilter implements ExceptionFilter<CooldownStoreError> {
  async catch(error: CooldownStoreError, context: ExecutionContext) {
    await context.response?.error(error, { message: 'Hold on a moment and try again.', visibility: 'private' })
  }
}

Members

constructor

new CooldownStoreError(cause: unknown, timedOut: boolean)

Parameters

NameTypeDescription
causeunknown

What the store threw or rejected with; undefined when it did not answer in time.

timedOutboolean

Whether the store did not answer within cooldownStoreTimeoutMs.

timedOut

readonly timedOut: boolean