3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/faraday/response/rainmaker_errors.rb', line 3
def on_complete(env)
case env[:status]
when 400
raise Rainmaker::BadRequest.new(error_message(env), env[:response_headers])
when 401
raise Rainmaker::Unauthorized.new(error_message(env), env[:response_headers])
when 403
raise Rainmaker::Forbidden.new(error_message(env), env[:response_headers])
when 404
raise Rainmaker::NotFound.new(error_message(env), env[:response_headers])
when 422
raise Rainmaker::Invalid.new(error_message(env), env[:response_headers])
when 500
raise Rainmaker::InternalServerError.new(error_message(env), env[:response_headers])
when 502
raise Rainmaker::BadGateway.new(error_message(env), env[:response_headers])
when 503
raise Rainmaker::ServiceUnavailable.new(error_message(env), env[:response_headers])
end
end
|