4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/contactually/middleware/error_middleware.rb', line 4
def call(env)
@app.call(env).on_complete do |env|
case env.status
when 401
raise Contactually::UnauthorizedError.new(error_messages(env.response))
when 402
raise Contactually::PaymentRequiredError.new(error_messages(env.response))
when 403
raise Contactually::ForbiddenError.new(error_messages(env.response))
when 404
raise Contactually::NotFoundError.new(error_messages(env.response))
end
end
end
|