Every error a strategy raises extends ExecutionRejectedError and carries:
code: a stable, machine-readable string. Branch on it, not on the message.
source: { pipelineName, strategyName } of the strategy that raised it.
toJSON(): { name, code, message, retryAfter?, source? }, safe to log or send.
The HTTP status comes from describeResilienceError() / httpStatusFor() in resilience-pipeline/http. The /http, /fastify and /koa middlewares use the same mapping. A resilience error whose code isn’t in the table maps to 503.
A timeout fired before the callback finished (addTimeout, withTimeout, waitFor).
504
isTimeoutError
timeout (ms)
BrokenCircuitError
CIRCUIT_OPEN
The circuit is open, or half-open with every probe slot taken.
503
isBrokenCircuitError, isRejection
retryAfter (ms until a probe is allowed; 0 when half-open), cause (last failure that opened it)
IsolatedCircuitError
CIRCUIT_ISOLATED
The circuit is held open by CircuitBreakerManualControl.isolate(). Extends BrokenCircuitError.
503
isBrokenCircuitError, isRejection
retryAfter is undefined
RateLimiterRejectedError
RATE_LIMITED
A token bucket, fixed/sliding window or partitioned limiter has no permit within queueTimeout, its wait queue is full, or the key is blocked.
429
isRateLimitError, isRejection
retryAfter (ms, when known)
BulkheadRejectedError
BULKHEAD_FULL
A concurrency limiter (fixed or adaptive) is full, a queued call waited past queueTimeout, or it was dropped by overflow. Extends RateLimiterRejectedError.
The lock’s lease couldn’t be renewed while the callback ran. The callback’s signal is aborted with it, and the execution fails with it if the callback then fails. It extends plain Error, so describeResilienceError() returns undefined. Fields: key.
none
none (check code)
NonRetryableError
none
Throw it from your callback to stop retrying at once. The caller receives the original error (cause), never the wrapper.
none
isNonRetryableError
UnexpectedError
UNEXPECTED
Only from pipeline.settle(): wraps anything that isn’t a strategy error or an error you returned with Outcome.fromError(). Fields: cause.
instanceof fails when two copies of the package are loaded (ESM and CJS side by side, or nested installs). The guards check a registered symbol and the code instead, so they keep working:
Polly-style builder with a shortcut for every strategy: addRetry(), addTimeout(), addCircuitBreaker(), …
Convenient, but it bundles every strategy. For the smallest browser bundle use PipelineBuilder with
retryStrategy(), timeoutStrategy(), … instead; the two are interchangeable.
The type parameters track which errors the pipeline can raise, for pipeline.settle() + Outcome.match().
Transport-neutral description of a resilience error, or undefined for any other error. Use it to build an HTTP
response, GraphQL extensions: { code, httpStatus, retryAfter }, a gRPC status, or a WebSocket error frame.
Works across duplicate copies of this package (uses error codes, not instanceof).
Polly-style builder with a shortcut for every strategy: addRetry(), addTimeout(), addCircuitBreaker(), …
Convenient, but it bundles every strategy. For the smallest browser bundle use PipelineBuilder with
retryStrategy(), timeoutStrategy(), … instead; the two are interchangeable.
The type parameters track which errors the pipeline can raise, for pipeline.settle() + Outcome.match().
The console module provides a simple debugging console that is similar to the
JavaScript console mechanism provided by web browsers.
The module exports two specific components:
A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
A global console instance configured to write to process.stdout and
process.stderr. The global console can be used without importing the node:console module.
Warning: The global console object's methods are neither consistently
synchronous like the browser APIs they resemble, nor are they consistently
asynchronous like all other Node.js streams. See the note on process I/O for
more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(newError('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
constname='Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
constout=getStreamSomehow();
consterr=getStreamSomehow();
constmyConsole=new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(newError('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
The console module provides a simple debugging console that is similar to the
JavaScript console mechanism provided by web browsers.
The module exports two specific components:
A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
A global console instance configured to write to process.stdout and
process.stderr. The global console can be used without importing the node:console module.
Warning: The global console object's methods are neither consistently
synchronous like the browser APIs they resemble, nor are they consistently
asynchronous like all other Node.js streams. See the note on process I/O for
more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(newError('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
constname='Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
constout=getStreamSomehow();
consterr=getStreamSomehow();
constmyConsole=new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(newError('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
The console module provides a simple debugging console that is similar to the
JavaScript console mechanism provided by web browsers.
The module exports two specific components:
A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
A global console instance configured to write to process.stdout and
process.stderr. The global console can be used without importing the node:console module.
Warning: The global console object's methods are neither consistently
synchronous like the browser APIs they resemble, nor are they consistently
asynchronous like all other Node.js streams. See the note on process I/O for
more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(newError('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
constname='Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
constout=getStreamSomehow();
consterr=getStreamSomehow();
constmyConsole=new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(newError('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
Transport-neutral description of a resilience error, or undefined for any other error. Use it to build an HTTP
response, GraphQL extensions: { code, httpStatus, retryAfter }, a gRPC status, or a WebSocket error frame.
Works across duplicate copies of this package (uses error codes, not instanceof).
describeResilienceError(
var error:unknown
error);
// { code, httpStatus, retryAfter (seconds), message, source } or undefined for other errors
}
describeResilienceError() converts retryAfter to seconds (rounded up), ready for a Retry-After header, GraphQL extensions or a gRPC status. On the error itself, retryAfter is in milliseconds.