Exception: Orcid::RemoteServiceError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/orcid/exceptions.rb

Overview

Because in trouble shooting what all goes into this remote call, you may very well want all of this.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ RemoteServiceError

Returns a new instance of RemoteServiceError.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/orcid/exceptions.rb', line 5

def initialize(options)
  text = []
  text << "-- Client --"
  if client = options[:client]
    text << "id:\n\t#{client.id.inspect}"
    text << "site:\n\t#{client.site.inspect}"
    text << "options:\n\t#{client.options.inspect}"
  end
  text << "\n-- Token --"
  if token = options[:token]
    text << "access_token:\n\t#{token.token.inspect}"
    text << "refresh_token:\n\t#{token.refresh_token.inspect}"
  end
  text << "\n-- Request --"
  text << "path:\n\t#{options[:request_path].inspect}" if options[:request_path]
  text << "headers:\n\t#{options[:request_headers].inspect}" if options[:request_headers]
  text << "body:\n\t#{options[:request_body]}" if options[:request_body]
  text << "\n-- Response --"
  text << "status:\n\t#{options[:response_status].inspect}" if options[:response_status]
  text << "body:\n\t#{options[:response_body]}" if options[:response_body]
  super(text.join("\n"))
end