Skip to content

Commit

Permalink
Alter to exclude success http responses from the handler.
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Perry <nperry@mavenlink.com>
  • Loading branch information
wilkinsondesouza and ncperry committed Jun 6, 2024
1 parent 43ca1c4 commit a5682e9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/qualtrics_api/request_error_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module QualtricsAPI
class RequestErrorHandler < Faraday::Response::Middleware
HTTP_RESPONSE_ERROR_RANGE = 400..599

def on_complete(env)
raise_http_errors(env[:status], env[:body])
show_notices(env[:body])
Expand All @@ -14,6 +16,8 @@ def raise_http_errors(code, body)
when 200, 202
return
else
return unless HTTP_RESPONSE_ERROR_RANGE.include?(code)

raise http_error_class(code), error_message(JSON.parse(body))
end
end
Expand Down

0 comments on commit a5682e9

Please sign in to comment.