syncguard
Version:
Functional TypeScript library for distributed locking across microservices. Prevents race conditions with Redis, PostgreSQL, Firestore, and custom backends. Features automatic lock management, timeout handling, and extensible architecture.
22 lines (21 loc) • 936 B
TypeScript
/**
* Thrown by all lock operations for system errors, timeouts, and failures.
* Use `code` to distinguish error types and `context` for debugging details.
*/
export declare class LockError extends Error {
code: "ServiceUnavailable" | "AuthFailed" | "InvalidArgument" | "RateLimited" | "NetworkTimeout" | "AcquisitionTimeout" | "Aborted" | "Internal";
/** Debugging context: lock key, ID, and underlying error */
context?: {
key?: string;
lockId?: string;
cause?: unknown;
} | undefined;
constructor(code: "ServiceUnavailable" | "AuthFailed" | "InvalidArgument" | "RateLimited" | "NetworkTimeout" | "AcquisitionTimeout" | "Aborted" | "Internal", // Unexpected backend errors or quota limits
message?: string,
/** Debugging context: lock key, ID, and underlying error */
context?: {
key?: string;
lockId?: string;
cause?: unknown;
} | undefined);
}