Skip to content

Commit

Permalink
fix: handle "Error: Cannot set property 'retries' of undefined"
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Feb 1, 2019
1 parent a3097b9 commit 35979dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/error-request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = errorRequest

async function errorRequest (octokit, state, error, options) {
if (!error.request || !error.request.request) {
// address https://github.com/octokit/plugin-retry.js/issues/8
throw error
}

// retry all >= 400 && not doNotRetry
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
const retries = options.request.retries != null ? options.request.retries : state.retries
Expand Down

0 comments on commit 35979dd

Please sign in to comment.