Module: utils/errorClassifier

Shared error classification for user-facing messages.

Converts raw Error objects from AI providers, Playwright, and network failures into actionable, user-friendly messages. Used by:

  • routes/chat.js — chat SSE error events
  • utils/runWithAbort.js — run-level failure messages
  • testRunner.js — browser launch / trace setup failures
  • crawler.js — pipeline warning messages

Design

A single classifyError(err, context) function handles all domains. The optional context parameter ("chat" | "run" | "crawl") lets the classifier tailor fallback messages and context-window hints.

Exports

  • classifyError — Classify any error into a user-friendly string.
  • ERROR_CATEGORY — Enum of error category IDs (for frontend styling).
Source:

Members

(static, constant) ERROR_CATEGORY :string

Error category identifiers. Stored on run.errorCategory so the frontend can render category-specific banners, icons, and action buttons.

Type:
  • string
Source:

Methods

(static) classifyError(err, contextopt) → {Object}

Classify an error into a user-friendly message and category.

Parameters:
Name Type Attributes Default Description
err Error

The raw error.

context "chat" | "run" | "crawl" <optional>
"run"

Where the error occurred (tailors hints).

Source:
Returns:

User-facing message and category ID.

Type
Object