UNPKG

durable-execution

Version:

A durable task engine for running tasks durably and resiliently

63 lines 2 kB
import { CustomError } from 'ts-custom-error'; /** * The type of a durable execution error. * * @category Errors */ export type DurableExecutionErrorType = 'generic' | 'timed_out' | 'cancelled'; /** * Base class for all errors thrown by {@link DurableExecutor} and {@link DurableTask}. * * @category Errors */ export declare class DurableExecutionError extends CustomError { /** * Whether the error is retryable. */ readonly isRetryable: boolean; /** * @param message - The error message. * @param isRetryable - Whether the error is retryable. */ constructor(message: string, isRetryable?: boolean); getErrorType(): DurableExecutionErrorType; } /** * Error thrown when a task is timed out. If this error is thrown in a task's run method, the task * will be marked as timed out. It might be retried based on the task's configuration and the * `isRetryable` flag. * * @category Errors */ export declare class DurableExecutionTimedOutError extends DurableExecutionError { /** * @param message - The error message. */ constructor(message?: string, isRetryable?: boolean); getErrorType(): DurableExecutionErrorType; } /** * Error thrown when a task is cancelled. If this error is thrown in a task's run method, the task * will be marked as cancelled. It will never be retried. * * @category Errors */ export declare class DurableExecutionCancelledError extends DurableExecutionError { /** * @param message - The error message. */ constructor(message?: string); getErrorType(): DurableExecutionErrorType; } /** * A storage object for a durable execution error. * * @category Errors */ export type DurableExecutionErrorStorageObject = { errorType: DurableExecutionErrorType; message: string; isRetryable: boolean; }; export declare function convertDurableExecutionErrorToStorageObject(error: DurableExecutionError): DurableExecutionErrorStorageObject; //# sourceMappingURL=errors.d.ts.map