Skip to content

Commit

Permalink
Add DEFAULT_EXCEPTIONS constant to Request::Retry (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
krmannix authored and iMacTia committed Aug 23, 2018
1 parent f08a985 commit f26a8d6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/faraday/request/retry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Faraday
#
class Request::Retry < Faraday::Middleware

DEFAULT_EXCEPTIONS = [Errno::ETIMEDOUT, 'Timeout::Error', Error::TimeoutError, Faraday::Error::RetriableResponse].freeze

This comment has been minimized.

Copy link
@indrekj

indrekj Sep 6, 2019

do you know if these should include Faraday::Error::ConnectionFailed ?

This comment has been minimized.

Copy link
@iMacTia

iMacTia Sep 13, 2019

Member

Yeah it sounds reasonable to me 👍
Feel free to open an issue/PR so we can discuss in more details and double-check if I'm missing anything

IDEMPOTENT_METHODS = [:delete, :get, :head, :options, :put]

class Options < Faraday::Options.new(:max, :interval, :max_interval, :interval_randomness,
Expand Down Expand Up @@ -57,9 +58,7 @@ def backoff_factor
end

def exceptions
Array(self[:exceptions] ||= [Errno::ETIMEDOUT, 'Timeout::Error',
Error::TimeoutError,
Faraday::Error::RetriableResponse])
Array(self[:exceptions] ||= DEFAULT_EXCEPTIONS)
end

def methods
Expand Down

0 comments on commit f26a8d6

Please sign in to comment.