Sha256: a10b73f704b1f5abc3002417454e71a786cdf949393ec0200e8bf44710537574

Contents?: true

Size: 491 Bytes

Versions: 16

Compression:

Stored size: 491 Bytes

Contents

# encoding: utf-8

require 'faraday'
require 'github_api/error'

module Github
  class Response::RaiseError < Faraday::Response::Middleware

    def on_complete(env)
      status_code   = env[:status].to_i
      service_error = Github::Error::ServiceError
      error_class = service_error.errors[status_code]
      error_class = service_error if !error_class and (400...600) === status_code
      raise error_class.new(env) if error_class
    end

  end # Response::RaiseError
end # Github

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
github_api-0.14.3 lib/github_api/response/raise_error.rb
github_api-0.14.2 lib/github_api/response/raise_error.rb
github_api-0.14.1 lib/github_api/response/raise_error.rb
github_api-0.14.0 lib/github_api/response/raise_error.rb
github_api-0.13.1 lib/github_api/response/raise_error.rb
github_api-0.13.0 lib/github_api/response/raise_error.rb
github_api-0.12.4 lib/github_api/response/raise_error.rb
github_api-0.12.3 lib/github_api/response/raise_error.rb
github_api-0.12.2 lib/github_api/response/raise_error.rb
github_api-0.12.1 lib/github_api/response/raise_error.rb
github_api-0.12.0 lib/github_api/response/raise_error.rb
github_api-0.11.3 lib/github_api/response/raise_error.rb
github_api-0.11.2 lib/github_api/response/raise_error.rb
github_api-0.11.1 lib/github_api/response/raise_error.rb
github_api-0.11.0 lib/github_api/response/raise_error.rb
github_api-0.10.2 lib/github_api/response/raise_error.rb