Exception: Ghee::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Ghee::Error
- Defined in:
- lib/ghee/errors.rb
Overview
Custom error class for rescuing from all GitHub errors
Direct Known Subclasses
BadGateway, BadRequest, Forbidden, InternalServerError, NotAcceptable, NotFound, NotImplemented, ServiceUnavailable, Unauthorized, UnprocessableEntity
Instance Method Summary collapse
-
#initialize(response = nil) ⇒ Error
constructor
A new instance of Error.
- #response_body ⇒ Object
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() end |
Instance Method Details
#response_body ⇒ Object
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 |