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.

66 lines 1.53 kB
/** * @module Async */ /** * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group Errors */ export class AsyncError extends Error { constructor(message, cause) { super(message, { cause }); this.name = AsyncError.name; } } /** * This error is thrown when the is aborted. * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group Errors */ export class AbortAsyncError extends AsyncError { constructor(message, cause) { super(message, cause); this.name = AbortAsyncError.name; } } /** * This error is thrown when the has exceeded the given time limit. * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group Errors */ export class TimeoutAsyncError extends AsyncError { constructor(message, cause) { super(message, cause); this.name = TimeoutAsyncError.name; } } /** * This error is thrown when the has failed all retry attempts. * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group Errors */ export class RetryAsyncError extends AsyncError { maxAttempts; errors = []; constructor(message, { errors, maxAttempts }) { super(message, errors[errors.length - 1]); this.errors = errors; this.maxAttempts = maxAttempts; this.name = RetryAsyncError.name; } } /** * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group Errors */ export const ASYNC_ERRORS = { Base: AsyncError, Abort: AbortAsyncError, Timeout: TimeoutAsyncError, Retry: RetryAsyncError, }; //# sourceMappingURL=async.errors.js.map