Exception: Wayback::Error::ClientError

Inherits:
Wayback::Error show all
Defined in:
lib/wayback/error/client_error.rb

Overview

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

Constant Summary

Constants inherited from Wayback::Error

EnhanceYourCalm, RateLimited

Instance Attribute Summary

Attributes inherited from Wayback::Error

#wrapped_exception

Class Method Summary collapse

Methods inherited from Wayback::Error

#backtrace, descendants, errors, #initialize

Constructor Details

This class inherits a constructor from Wayback::Error

Class Method Details

.from_response(response = {}) ⇒ Wayback::Error

Create a new error from an HTTP environment

Parameters:

  • response (Hash) (defaults to: {})

Returns:



12
13
14
# File 'lib/wayback/error/client_error.rb', line 12

def self.from_response(response={})
  new(parse_error(response[:body]), response[:response_headers])
end

.parse_error(body) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/wayback/error/client_error.rb', line 18

def self.parse_error(body)
  if body.nil? || body.is_a?(String)
    ''
  # elsif body[:error]
  #   body[:error]
  end
end