ERROR_CODES
Stable framework error codes shared by protocol-enabled servers and redweb/client.
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 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 pattern explains the named API. Application classes, credentials, and assets may need to be supplied; use a complete recipe for a runnable starting point.
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.