@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.
48 lines (47 loc) • 1.95 kB
TypeScript
/**
* @module CircuitBreaker
*/
import { type IKey } from "../../namespace/contracts/_module.js";
import { type InferInstance } from "../../utilities/_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: IKey, 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: IKey, 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 = InferInstance<(typeof CIRCUIT_BREAKER_ERRORS)[keyof typeof CIRCUIT_BREAKER_ERRORS]>;
/**
* IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/contracts"`
* @group Errors
*/
export declare function isCircuitBreakerError(value: unknown): value is AllCircuitBreakerErrors;