@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 • 1.06 kB
JavaScript
/**
* @module Resilience
*/
/**
*
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
* @group Errors
*/
export class TimeoutResilienceError extends Error {
constructor(message, cause) {
super(message, { cause });
this.name = TimeoutResilienceError.name;
}
}
/**
*
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
* @group Errors
*/
export class RetryResilienceError extends AggregateError {
constructor(errors, message) {
super(errors, message);
this.name = RetryResilienceError.name;
}
}
/**
*
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
* @group Errors
*/
export const RESILIENCE_ERRORS = {
Retry: RetryResilienceError,
Timeout: TimeoutResilienceError,
};
/**
*
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
* @group Errors
*/
export function isResilienceError(value) {
for (const ErrorClass of Object.values(RESILIENCE_ERRORS)) {
if (!(value instanceof ErrorClass)) {
return false;
}
}
return true;
}
//# sourceMappingURL=resilience.errors.js.map