class Base::RaiseError

Middleware to raise error on 422 and 401

Public Instance Methods

on_complete(env) click to toggle source
# File lib/base/endpoint.rb, line 10
def on_complete(env)
  case env[:status]
  when 422
    raise InvalidRequest, JSON.parse(env.body)
  when 401
    raise Unauthorized
  end
end