Exception: Ghee::Error

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

Overview

Custom error class for rescuing from all GitHub errors

Instance Method Summary collapse

Constructor Details

#initialize(response = nil) ⇒ Error

Returns a new instance of Error.



7
8
9
10
# File 'lib/ghee/errors.rb', line 7

def initialize(response=nil)
  @response = response
  super(build_error_message)
end

Instance Method Details

#response_bodyObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ghee/errors.rb', line 12

def response_body
  @response_body ||= if (body = @response[:body]) && !body.empty?
    if false and body.is_a?(String)
      MultiJson.load(body, :symbolize_keys => true)
    else
      body
    end
  else
    nil
  end
end