class ZuoraConnect::JsonParseErrors

def call(env)

def call(env)
  begin
    @app.call(env)
  rescue ActionDispatch::ParamsParser::ParseError => error
    if env['HTTP_ACCEPT'] =~ /application\/json/ || env['CONTENT_TYPE'] =~ /application\/json/
      return [
        400, { "Content-Type" => "application/json" },
        [{"success": false, "reasons": [{"code": 50000090, "message": "Malformed json was submitted." }]}.to_json ]
      ]
    else
      raise error
    end
  end
end

def initialize(app)

def initialize(app)
  @app = app
end