Skip to main content
Dotset CLI API Documentation / index / SerializedError

Interface: SerializedError

Defined in: src/mantle/errors/index.ts:126 Error Handling and Recovery Module Comprehensive error handling with retry logic and circuit breakers.

Example

import {
  withRetry,
  withTimeout,
  CircuitBreaker,
  isRetryableError,
} from '@dotsetlabs/cli';

// Retry with exponential backoff
const result = await withRetry(
  () => fetchSecrets(),
  { maxAttempts: 3, baseDelayMs: 1000, backoffMultiplier: 2 }
);

// Add timeout to operation
const secrets = await withTimeout(fetchSecrets(), 5000);

// Use circuit breaker for external services
const breaker = new CircuitBreaker('aws-sm', {
  failureThreshold: 5,
  resetTimeoutMs: 30000,
});

const secret = await breaker.execute(() => getFromAWS(key));

Properties

cause?

optional cause: string;
Defined in: src/mantle/errors/index.ts:134

code

code: ErrorCode;
Defined in: src/mantle/errors/index.ts:128

context?

optional context: ErrorContext;
Defined in: src/mantle/errors/index.ts:132

isRetryable

isRetryable: boolean;
Defined in: src/mantle/errors/index.ts:130

message

message: string;
Defined in: src/mantle/errors/index.ts:129

name

name: string;
Defined in: src/mantle/errors/index.ts:127

remediation?

optional remediation: string[];
Defined in: src/mantle/errors/index.ts:133

retryAfterMs?

optional retryAfterMs: number;
Defined in: src/mantle/errors/index.ts:131

stack?

optional stack: string;
Defined in: src/mantle/errors/index.ts:135