7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/slack/web/faraday/response/raise_error.rb', line 7
def on_complete(env)
raise Slack::Web::Api::Errors::TooManyRequestsError, env.response if env.status == 429
return unless env.success?
body = env.body
return unless body
return if body['ok']
error_message =
body['error'] || body['errors'].map { |message| message['error'] }.join(',')
error_class = Slack::Web::Api::Errors::ERROR_CLASSES[error_message]
error_class ||= Slack::Web::Api::Errors::SlackError
raise error_class.new(error_message, env.response)
end
|