ERROR_CODES

Documentation for Redweb 0.13.3. Install that exact version when following these examples.

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

Explain it like I’m five

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

When should I use it?

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

Follow the example

This API pattern illustrates the named surface; it may require application-owned classes, credentials, or assets. Start from a complete recipe for a runnable application.

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

// INVALID_MESSAGE, UNKNOWN_HANDLER, HANDLER_FAILED,
// BINARY_UNSUPPORTED, RATE_LIMITED, QUEUE_FULL,
// CAPACITY_REACHED, INITIALIZATION_FAILED
  1. The server emits a stable code inside its error envelope.
  2. The client compares it with ERROR_CODES instead of copying a string literal.
  3. UI or retry policy can change independently of the readable error message.

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.

What should I watch for?

Codes describe protocol outcomes, not every domain failure. Add your own namespaced application codes without changing Redweb’s meanings.