Skip to content

Commit

Permalink
Provide unexpected error code in error message (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanecav84 authored and forest committed Oct 9, 2017
1 parent bf9a083 commit 5bf3e1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tracker_api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,11 @@ def request(method, options = {})
end
response
rescue Faraday::Error::ClientError => e
case e.response[:status]
status_code = e.response[:status]
case status_code
when 400..499 then raise TrackerApi::Errors::ClientError.new(e)
when 500..599 then raise TrackerApi::Errors::ServerError.new(e)
else raise "Expected 4xx or 5xx HTTP status code"
else raise "Expected 4xx or 5xx HTTP status code; got #{status_code} instead."
end
end

Expand Down

0 comments on commit 5bf3e1d

Please sign in to comment.