Sha256: f8203781ee6f94b3f77cfd4e5f518377ecc97bf61faf698c0d9280f8f3ddcbb5

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

module Slack
  module Web
    module Faraday
      module Response
        class RaiseError < ::Faraday::Response::Middleware
          def on_complete(env)
            if env.status == 429
              fail Slack::Web::Api::Errors::TooManyRequestsError, env.response
            elsif (body = env.body) && body['ok']
              return
            else
              fail Slack::Web::Api::Errors::SlackError.new(body['error'], env.response)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-client-0.10.0 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.9.1 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.9.0 lib/slack/web/faraday/response/raise_error.rb