Exception: Zenodo::Errors::ClientError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/zenodo/errors/client_error.rb

Direct Known Subclasses

ResourceNotFoundError

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ClientError

Returns a new instance of ClientError.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/zenodo/errors/client_error.rb', line 4

def initialize(options={})
  method = options[:method] || raise(ArgumentError, "Must supply :method")
  url = options[:url] || raise(ArgumentError, "Must supply :url")
  response = options[:response] || raise(ArgumentError, "Must supply :response")
  headers = options[:headers]

  super <<-STR.gsub(/^\s*/, '')
    HTTP #{method} #{url}
    Request Headers: #{headers}
    Response Headers: #{response.headers}\n
    Response Body:\n#{response.body}
  STR
  @response = response
end