UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

50 lines (49 loc) 1.82 kB
/** * @module CircuitBreaker */ import { type Key } from "../../namespace/_module.js"; /** * The error is thrown when circuit breaker is in open state and will not allow any attempts. * * IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/contracts"` * @group Errors */ export declare class OpenCircuitBreakerError extends Error { static create(key: Key, cause?: unknown): OpenCircuitBreakerError; /** * Note: Do not instantiate `OpenCircuitBreakerError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } export declare class IsolatedCircuitBreakerError extends Error { static create(key: Key, cause?: unknown): IsolatedCircuitBreakerError; /** * Note: Do not instantiate `IsolatedCircuitBreakerError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } /** * * IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/contracts"` * @group Errors */ export declare const CIRCUIT_BREAKER_ERRORS: { readonly Open: typeof OpenCircuitBreakerError; readonly Isolated: typeof IsolatedCircuitBreakerError; }; /** * * IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/contracts"` * @group Errors */ export type AllCircuitBreakerErrors = OpenCircuitBreakerError; /** * * IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/contracts"` * @group Errors */ export declare function isCircuitBreakerError(value: unknown): value is AllCircuitBreakerErrors;