1 | // @ts-ignore
|
2 | export async function errorRequest(octokit, state, error, options) {
|
3 | if (!error.request || !error.request.request) {
|
4 | // address https://github.com/octokit/plugin-retry.js/issues/8
|
5 | throw error;
|
6 | }
|
7 | // retry all >= 400 && not doNotRetry
|
8 | if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
|
9 | const retries = options.request.retries != null ? options.request.retries : state.retries;
|
10 | const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
|
11 | throw octokit.retry.retryRequest(error, retries, retryAfter);
|
12 | }
|
13 | // Maybe eventually there will be more cases here
|
14 | throw error;
|
15 | }
|