Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

fixing wrong Error type #121

Merged
merged 11 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.11.5
* use ServiceClientError type for Errors in shouldRetry and onRetry options.

## 0.11.3

* Use `timing` option from client if `timing` is not set in the request options. #91
Expand Down
14 changes: 10 additions & 4 deletions lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@ export class ServiceClientOptions {
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
shouldRetry?: (err?: Error, req?: ServiceClientRequestOptions) => boolean;
shouldRetry?: (
err?: ServiceClientError,
req?: ServiceClientRequestOptions
) => boolean;
onRetry?: (
currentAttempt?: number,
err?: Error,
err?: ServiceClientError,
req?: ServiceClientRequestOptions
) => void;
};
Expand All @@ -117,10 +120,13 @@ class ServiceClientStrictOptions {
minTimeout: number;
maxTimeout: number;
randomize: boolean;
shouldRetry: (err?: Error, req?: ServiceClientRequestOptions) => boolean;
shouldRetry: (
err?: ServiceClientError,
req?: ServiceClientRequestOptions
) => boolean;
onRetry: (
currentAttempt?: number,
err?: Error,
err?: ServiceClientError,
req?: ServiceClientRequestOptions
) => void;
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perron",
"version": "0.11.4",
"version": "0.11.5",
"description": "A sane client for web services",
"engines": {
"node": ">=12.0.0"
Expand Down
Loading