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

    Function useCommandError

    • useCommandError — component-scoped error boundary for command failures.

      Subscribes to the bus and captures all failed command results reactively. Optional filter narrows which actions are tracked.

      Parameters

      • options: { filter?: (cmd: Command) => boolean } = {}

      Returns {
          errors: Signal<ErrorEntry[]>;
          latestError: Signal<Error | null>;
          clearErrors: () => void;
          dispose: () => void;
      }

      const { latestError, errors, clearErrors } = useCommandError()

      // Only watch cart commands
      const { latestError } = useCommandError({ filter: cmd => cmd.action.startsWith('cart') })