class Echowrap::Error::ClientError

Raised when Echowrap returns a 4xx HTTP status code or there’s an error in Faraday

Public Class Methods

from_response(response={}) click to toggle source

Create a new error from an HTTP environment

@param response [Hash] @return [Echowrap::Error]

# File lib/echowrap/error/client_error.rb, line 12
def self.from_response(response={})
  new(parse_error(response[:body]), response[:response_headers])
end

Private Class Methods

parse_error(body) click to toggle source
# File lib/echowrap/error/client_error.rb, line 18
def self.parse_error(body)
  body[:response][:status][:message]
end