Constants · In depth

ERROR_CODES

Stable framework error codes shared by protocol-enabled servers and redweb/client.

Explain it like I’m five

The simple mental model

ERROR_CODES is a shared list of machine-readable reasons, like standardized traffic signs that every client interprets the same way.

When it fits

When should I use it?

Use these constants whenever application behavior depends on a Redweb protocol failure rather than human-facing wording.

A practical API pattern

Follow the example

This pattern explains the named API. Application classes, credentials, and assets may need to be supplied; use a complete recipe for a runnable starting point.

Read this article as Markdown

JavaScript
const { ERROR_CODES } = require('redweb')

// INVALID_MESSAGE, UNKNOWN_HANDLER, HANDLER_FAILED,
// BINARY_UNSUPPORTED, RATE_LIMITED, QUEUE_FULL,
// CAPACITY_REACHED, INITIALIZATION_FAILED
  1. 1

    The server emits a stable code inside its error envelope.

  2. 2

    The client compares it with ERROR_CODES instead of copying a string literal.

  3. 3

    UI or retry policy can change independently of the readable error message.

Surface area

Methods and members

Message errors

INVALID_MESSAGE, UNKNOWN_HANDLER, HANDLER_FAILED, and BINARY_UNSUPPORTED.

Capacity errors

RATE_LIMITED, QUEUE_FULL, and CAPACITY_REACHED.

Lifecycle errors

INITIALIZATION_FAILED.