A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://rubydoc.info/github/piotrmurach/github/master/Github/Error/ServiceError below:

ServiceError – Documentation for piotrmurach/github (master) – RubyDoc.info

Exception: Github::Error::ServiceError Direct Known Subclasses

BadGateway, BadRequest, Conflict, Forbidden, InternalServerError, MethodNotAllowed, NotAcceptable, NotFound, NotImplemented, ServiceUnavailable, Unauthorized, UnavailableForLegalReasons, UnprocessableEntity, UnsupportedMediaType

Constant Summary collapse
MIN_BODY_LENGTH =
2
Instance Attribute Summary Attributes inherited from GithubError

#response_headers, #response_message

Class Method Summary collapse Instance Method Summary collapse Methods inherited from GithubError

#backtrace

Constructor Details #initialize(response) ⇒ ServiceError
41
42
43
44
45
46
47
48
49
50
# File 'lib/github_api/error/service_error.rb', line 41

def initialize(response)
  @headers = response[:response_headers]
  @body    = response[:body]
  @status  = response[:status]

  @response_headers = @headers
  @response_message = @body

  super(create_message(response))
end
Class Method Details .error_mappingHash[Integer, Object]

A mapping of status codes and error types

26
27
28
29
30
31
32
# File 'lib/github_api/error/service_error.rb', line 26

def self.error_mapping
  @error_mapping ||= Hash[
    descendants.map do |klass|
      [klass.new({}).http_status_code, klass]
    end
  ]
end
.http_status_code(code) ⇒ Object

Add http status code method to error type

17
18
19
# File 'lib/github_api/error/service_error.rb', line 17

def self.http_status_code(code)
  define_method(:http_status_code) { code }
end
Instance Method Details #dataHash[Symbol]|String

Expose response payload as JSON object if possible

57
58
59
# File 'lib/github_api/error/service_error.rb', line 57

def data
  @data ||= decode_data(@body)
end
#error_messagesArray[Hash[Symbol]]

Stores error message(s) returned in response body

67
68
69
70
71
# File 'lib/github_api/error/service_error.rb', line 67

def error_messages
  @error_messages ||= begin
    data[:errors] ? data[:errors] : [data]
  end
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4