Skip to content

Commit

Permalink
Add retryable description
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Aug 7, 2023
1 parent f6cab8b commit 9638d7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/client/src/helpers/runWithRetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class RetryError extends Error {
}

/**
* Function which wraps asynchronous functions with error handler which checks whether response with code `200`
* Function which wraps asynchronous RPC methods with error handler which checks whether response with code `200`
* holds error data, if it does, it throws `RpcError` to prevent false positives for `runWithRetry` retry handler.
*/
export const handleFalsePositiveResponse = <
Expand Down Expand Up @@ -158,6 +158,9 @@ export const RetryPreset = {
}),
} as const;

/**
* `runWithRetry` wrapper with pre-defined strategies (`RetryPreset`) and built in `handleFalsePositiveResponse` for RPC methods.
*/
export const retryable = <
T extends FunctionToRetry,
E extends keyof typeof RetryPreset,
Expand Down

0 comments on commit 9638d7e

Please sign in to comment.