class MercuryWebParser::Error::ClientError

Raised when Mercury returns a 4xx or 500 HTTP status code

Public Class Methods

new(error = nil) click to toggle source

Creates a new error from an HTTP environement

@param response [Hash] @return [MercuryWebParser::Error::ClientError]

Calls superclass method
# File lib/mercury_web_parser/error.rb, line 9
def initialize(error = nil)
  http_error = error.response[:status].to_i

  if ERROR_MAP.key?(http_error)
    raise ERROR_MAP[http_error], error.response[:body]['message']
  end

  super
end