A RetroSearch Logo

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

Search Query:

Showing content from https://rubydoc.info/github/piotrmurach/github/master/Github/Response/RaiseError below:

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

Class: Github::Response::RaiseError
Inherits:
Faraday::Response::Middleware show all
Defined in:
lib/github_api/response/raise_error.rb
Instance Method Summary collapse Instance Method Details #on_complete(env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check if status code requires raising a ServiceError

12
13
14
15
16
17
18
19
20
# File 'lib/github_api/response/raise_error.rb', line 12

def on_complete(env)
  status_code   = env[:status].to_i
  service_error = Github::Error::ServiceError
  error_class = service_error.error_mapping[status_code]
  if !error_class and (400...600) === status_code
    error_class = service_error
  end
  raise error_class.new(env) if error_class
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