Class: Slack::Web::Faraday::Response::RaiseError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/slack/web/faraday/response/raise_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/slack/web/faraday/response/raise_error.rb', line 6

def on_complete(env)
  if env.status == 429
    raise Slack::Web::Api::Errors::TooManyRequestsError, env.response
  elsif (body = env.body) && body['ok']
    nil
  else
    raise Slack::Web::Api::Errors::SlackError.new(body['error'], env.response)
  end
end