5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/faraday/raise_4xx.rb', line 5
def on_complete(env)
case env[:status].to_i
when 400
raise Impermium::BadRequest.new(env[:method].to_s.upcase, env[:url].to_s, env[:body])
when 401
raise Impermium::UnauthorizedRequest.new(env[:method].to_s.upcase, env[:url].to_s, env[:body])
when 403
raise Impermium::ForbiddenRequest.new(env[:method].to_s.upcase, env[:url].to_s, env[:body])
when 404
raise Impermium::NotFoundRequest.new(env[:method].to_s.upcase, env[:url].to_s, env[:body])
end
end
|