Sha256: 3595e7db01b816d500fb41d0444926a060f56607c88ce45042414e731fc495e8

Contents?: true

Size: 587 Bytes

Versions: 9

Compression:

Stored size: 587 Bytes

Contents

module Slack
  module Web
    module Faraday
      module Response
        class RaiseError < ::Faraday::Response::Middleware
          def on_complete(env)
            if env.status == 429
              raise Slack::Web::Api::Errors::TooManyRequestsError, env.response
            elsif (body = env.body) && !body['ok']
              error_message = body['error'] || body['errors'].map { |message| message['error'] }.join(',')
              raise Slack::Web::Api::Errors::SlackError.new(error_message, env.response)
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slack-ruby-client-0.14.4 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.14.3 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.14.2 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.14.1 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.14.0 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.13.1 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.13.0 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.12.0 lib/slack/web/faraday/response/raise_error.rb
slack-ruby-client-0.11.1 lib/slack/web/faraday/response/raise_error.rb