Skip to content

Commit c2ba3db

Browse files
committed
Update README
1 parent dc1a8bd commit c2ba3db

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ const octokit = new MyOctokit({
7373
});
7474
```
7575

76+
You can override the default predicate that determines whether to retry a request based on the outcome of the previous attempt. For example, to retry if the response message includes a particular string. Note that the `doNotRetry` option from the constructor is ignored in this case.
77+
78+
```typescript
79+
const octokit = new MyOctokit({
80+
auth: "secret123",
81+
retry: {
82+
shouldRetry: (retryState: RetryState, error: any) => {
83+
if (isRequestError(error)) {
84+
return error.message.includes("Intermittent problem");
85+
}
86+
return false;
87+
},
88+
},
89+
});
90+
```
91+
7692
To override the number of retries:
7793

7894
```js

0 commit comments

Comments
 (0)