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

Commit

Permalink
fixing wrong Error type (#121)
Browse files Browse the repository at this point in the history
* fixing wrong Error type

* fixing the type for onRetry and shouldRetry

* bump to version 0.11.5 in package.json

* Update CHANGELOG.md

* fixing lint

* just retriggering stuck checks

* just retriggering stuck checks

* just retriggering stuck checks

* debuggibg zapper config

* adding type array to responce body

* bumping version in package-lock.json and reverting yarn.lock ignore

---------

Co-authored-by: hakroush <[email protected]>
  • Loading branch information
hibaAkroush and hakroush authored Oct 11, 2023
1 parent 6a5c0ab commit 5949440
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
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 lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ServiceClientResponse {
constructor(
public statusCode: number,
public headers: IncomingHttpHeaders,
public body: Buffer | string | object,
public body: Buffer | string | object | object[],
public request: ServiceClientRequestOptions
) {
this.retryErrors = [];
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

0 comments on commit 5949440

Please sign in to comment.