class Acumatica::ErrorHandler

Public Class Methods

new(app) click to toggle source
Calls superclass method
# File lib/acumatica/errors.rb, line 7
def initialize(app)
  super app
  @parser = nil
end

Public Instance Methods

call(request_env) click to toggle source
# File lib/acumatica/errors.rb, line 12
def call(request_env)
  @app.call(request_env).on_complete do |env|
    case env[:status]
    when 400
      raise Acumatica::BadRequest, env
    when 401
      raise Acumatica::Unauthorized, env
    when 500
      raise Acumatica::InternalServerError, env
    end
  end
end