Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/plaid/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ class Middleware < ::Faraday::Response::Middleware

# Internal: Default read timeout for HTTP calls in seconds.
NETWORK_TIMEOUT = 600
# Internal: Status codes recognized as client or server errors.
ERROR_STATUSES = 400...600

def on_complete(env)
return unless Faraday::Response::RaiseError::ClientErrorStatuses
.include?(env[:status])
return unless ERROR_STATUSES.include?(env[:status])

error_class = Plaid::Error.error_from_type(env.body['error_type'])

Expand Down