Skip to content

Commit

Permalink
feat: ignore HTTP 422 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Grondin authored and gr2m committed Feb 10, 2019
1 parent 8c5cd82 commit 5e1d577
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function retryPlugin (octokit, octokitOptions = {}) {
const state = Object.assign({
enabled: true,
retryAfterBaseValue: 1000,
doNotRetry: [ 400, 401, 403, 404 ],
doNotRetry: [ 400, 401, 403, 404, 422 ],
retries: 3
}, octokitOptions.retry)

Expand Down
4 changes: 2 additions & 2 deletions test/integration/backend-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ describe('Trigger Retries', function () {
expect(octokit.__requestTimings[3] - octokit.__requestTimings[2]).to.be.closeTo(450, 20)
})

it('Should not retry 3xx/400/401/403 errors', async function () {
it('Should not retry 3xx/400/401/403/422 errors', async function () {
const octokit = new Octokit({ retry: { retryAfterBaseValue: 50 } })
let caught = 0
const testStatuses = [ 304, 400, 401, 403, 404 ]
const testStatuses = [ 304, 400, 401, 403, 404, 422 ]

for (const status of testStatuses) {
try {
Expand Down

0 comments on commit 5e1d577

Please sign in to comment.