Popii - v0.5.1
    Preparing search index...

    Class PopiiError

    A structured, user-facing error for expected failure conditions.

    When errorHandlerPlugin() is active, throwing a PopiiError inside a command handler will display the message (and optional hint) to the user as an ephemeral reply, without logging a stack trace. Use it for business-logic errors you want to communicate cleanly rather than crash silently.

    import { PopiiError } from "popii";

    async do(pop) {
    const balance = pop.locals.dbUser.balance;
    if (balance < 100) {
    throw new PopiiError(
    "You don't have enough coins!",
    "INSUFFICIENT_FUNDS",
    "Check your balance with /balance"
    );
    }
    // deduct and proceed...
    }

    Hierarchy

    • Error
      • PopiiError
    Index

    Constructors

    Properties

    Constructors

    • Parameters

      • message: string
      • code: string
      • Optionalhint: string
      • Optionalpath: string

      Returns PopiiError

    Properties

    code: string

    Machine-readable error code for programmatic handling (e.g. "INSUFFICIENT_FUNDS").

    hint?: string

    Optional user-facing hint shown below the error message.

    path?: string

    Optional file path or context string for internal debugging.