Sha256: f2aaaa0fd9021cefb611a9113f5281f21207b41ff1275434e3aa9b1a64856ffa

Contents?: true

Size: 790 Bytes

Versions: 5

Compression:

Stored size: 790 Bytes

Contents

require 'faraday'
require 'twitter/error/bad_gateway'
require 'twitter/error/bad_request'
require 'twitter/error/forbidden'
require 'twitter/error/gateway_timeout'
require 'twitter/error/internal_server_error'
require 'twitter/error/not_acceptable'
require 'twitter/error/not_found'
require 'twitter/error/service_unavailable'
require 'twitter/error/too_many_requests'
require 'twitter/error/unauthorized'
require 'twitter/error/unprocessable_entity'

module Twitter
  module REST
    module Response
      class RaiseError < Faraday::Response::Middleware

        def on_complete(env)
          status_code = env[:status].to_i
          error_class = Twitter::Error.errors[status_code]
          raise error_class.from_response(env) if error_class
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter-5.1.1 lib/twitter/rest/response/raise_error.rb
twitter-5.1.0 lib/twitter/rest/response/raise_error.rb
twitter-5.0.1 lib/twitter/rest/response/raise_error.rb
twitter-5.0.0 lib/twitter/rest/response/raise_error.rb
twitter-5.0.0.rc.1 lib/twitter/rest/response/raise_error.rb