vapor-chamber API reference - v1.3.0
    Preparing search index...

    Class BusError

    BusError — structured error with machine-readable code, severity, and emitter.

    Extends native Error so it works everywhere errors work (catch, result.error, etc.). The code field enables switch-based handling, the severity enables log filtering, and the emitter enables source-based routing.

    const result = bus.dispatch('missing', {});
    if (!result.ok && result.error instanceof BusError) {
    console.log(result.error.code); // 'VC_CORE_NO_HANDLER'
    console.log(result.error.severity); // 'error'
    console.log(result.error.emitter); // 'core'
    console.log(result.error.action); // 'missing'
    }

    Hierarchy

    • Error
      • BusError
    Index

    Constructors

    • Parameters

      • code: BusErrorCode
      • message: string
      • opts: {
            severity?: BusSeverity;
            emitter?: BusEmitter;
            action?: string;
            context?: Record<string, unknown>;
            cause?: Error;
        } = {}

      Returns BusError

    Properties

    Machine-readable error code for switch/lookup.

    severity: BusSeverity

    Severity: error, warn, or info.

    emitter: BusEmitter

    Which subsystem produced this error.

    action?: string

    The action name involved (if applicable).

    context?: Record<string, unknown>

    Additional context (e.g. retryIn for throttle, threshold for circuit breaker).