idempotency-redis
Version:
Idempotency guarantee via Redis
88 lines (87 loc) • 4.66 kB
TypeScript
/**
* The base error class for idempotent operations.
*/
export declare class IdempotentExecutorErrorBase extends Error {
readonly idempotencyKey: string;
readonly cause?: unknown;
/**
* Constructs an instance of IdempotentExecutorErrorBase.
* @param message The error message describing what went wrong.
* @param idempotencyKey The unique key used to identify and enforce idempotency for an operation.
* @param cause (Optional) The underlying error or reason for this error, if any.
*/
constructor(message: string, idempotencyKey: string, cause?: unknown);
}
/**
* Represents a critical error related to idempotent operations, potentially leading to non-idempotent executions.
*/
export declare class IdempotentExecutorCriticalError extends IdempotentExecutorErrorBase {
/**
* Constructs an instance of IdempotentExecutorCriticalError.
* This error class should be used for critical issues that might lead to non-idempotent executions.
* @param message The error message describing the critical issue.
* @param idempotencyKey The unique key used to identify and enforce idempotency for an operation.
* @param cause (Optional) The underlying error or reason for this critical error, if any.
*/
constructor(message: string, idempotencyKey: string, cause?: unknown);
}
/**
* Represents an error related to serialization issues during idempotent operations.
*/
export declare class IdempotentExecutorSerializationError extends IdempotentExecutorErrorBase {
/**
* Constructs an instance of IdempotentExecutorSerializationError.
* This error class should be used for issues related to serialization during idempotent operations.
* @param message The error message describing the serialization issue.
* @param idempotencyKey The unique key used to identify and enforce idempotency for an operation.
* @param cause (Optional) The underlying error or reason for this serialization error, if any.
*/
constructor(message: string, idempotencyKey: string, cause?: unknown);
}
/**
* Represents an error related to cache issues during idempotent operations.
*/
export declare class IdempotentExecutorCacheError extends IdempotentExecutorErrorBase {
/**
* Constructs an instance of IdempotentExecutorCacheError.
* This error class should be used for issues related to caching during idempotent operations.
* @param message The error message describing the cache issue.
* @param idempotencyKey The unique key used to identify and enforce idempotency for an operation.
* @param cause (Optional) The underlying error or reason for this cache error, if any.
*/
constructor(message: string, idempotencyKey: string, cause?: unknown);
}
/**
* Represents an error related to callback issues during idempotent operations.
*/
export declare class IdempotentExecutorCallbackError extends IdempotentExecutorErrorBase {
readonly callback: 'onActionSuccess' | 'onActionError' | 'onSuccessReplay' | 'onErrorReplay';
/**
* Constructs an instance of IdempotentExecutorCallbackError.
* This error class should be used for issues related to executing user-provided
* callback functions during idempotent operations.
* @param message The error message describing the callback issue.
* @param idempotencyKey The unique key used to identify and enforce idempotency for an operation.
* @param cause (Optional) The underlying error or reason for this callback error, if any.
*/
constructor(message: string, idempotencyKey: string, callback: 'onActionSuccess' | 'onActionError' | 'onSuccessReplay' | 'onErrorReplay', cause?: unknown);
}
/**
* Represents a wrapper around non-error objects thrown by the action function.
*/
export declare class IdempotentExecutorNonErrorWrapperError extends IdempotentExecutorErrorBase {
constructor(message: string, idempotencyKey: string, cause?: unknown);
}
/**
* Represents an error related to executor issues during idempotent operations.
*/
export declare class IdempotentExecutorUnknownError extends IdempotentExecutorErrorBase {
/**
* Constructs an instance of IdempotentExecutorUnknownError.
* This error class should be used for unknown issues during idempotent operations.
* @param message The error message describing the unknown issue.
* @param idempotencyKey The unique key used to identify and enforce idempotency for an operation.
* @param cause (Optional) The underlying error or reason for this unknown error, if any.
*/
constructor(message: string, idempotencyKey: string, cause?: unknown);
}