Exception: Octokit::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/octokit/error.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)

Constructor Details

- (Error) initialize(response = nil)

A new instance of Error



4
5
6
7
# File 'lib/octokit/error.rb', line 4

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

Instance Method Details

- (Object) response_body



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/octokit/error.rb', line 9

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