CmpStr - v3.3.0
    Preparing search index...

    Class CmpStrError

    Base error class for CmpStr.

    It provides a standard code field and a consistent toString() / toJSON() output without changing the original error message expectations.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Constructor for CmpStrError.

      Will construct an error with a code, message, optional metadata, and optional cause.

      Parameters

      • code: string

        A short, machine-readable error code

      • message: string

        The error message (human-readable)

      • Optionalmeta: CmpStrErrorMeta

        Optional structured metadata for the error

      • Optionalcause: unknown

        Optional cause (native JS Error chaining)

      Returns CmpStrError

    Properties

    code: string

    A short, machine-readable error code

    Optional structured metadata for the error

    when: string = ...

    Timestamp when the error was created (ISO 8601)

    Methods

    • Format the error into a readable string, including code, message, and optional metadata.

      Parameters

      • Optionalstack: boolean = false

        Whether to include the stack trace in the output

      Returns string

    • Pretty string representation of the error.

      Returns string