Sha256: 53b6fe84719e6ac57f01a10e76fa7e857f74a44f7ba19e279edc08b3f9bcd553
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module Ecoportal module API module Common class Client module Error module Checks private def unexpected_server_error_code?(code) return true unless code return true if (code >= 500) && (code <= 599) code <= 99 end # Sometimes response body is wrong but status code # doesn't reflect. Let it retry def some_unexpected_error?(response) return true if unexpected_server_error_code?(response.status) unexpected_body?(response) end def unexpected_body?(response) response.body.nil?.tap do |wrong| next unless wrong msg = "Received non json body in response " msg << "(#{response.src_body.class}):\n " msg << response.src_body puts msg end end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecoportal-api-0.10.8 | lib/ecoportal/api/common/client/error/checks.rb |
ecoportal-api-0.10.7 | lib/ecoportal/api/common/client/error/checks.rb |