class Restforce::Middleware::RaiseError

def on_complete(env)

def on_complete(env)
  @env = env
  case env[:status]
  when 300
    raise Restforce::MatchesMultipleError.new(
      "300: The external ID provided matches more than one record",
      response_values
    )
  when 401
    raise Restforce::UnauthorizedError.new(message, response_values)
  when 404
    raise Restforce::NotFoundError.new(message, response_values)
  when 413
    raise Restforce::EntityTooLargeError.new(
      "413: Request Entity Too Large",
      response_values
    )
  when 400...600
    klass = exception_class_for_error_code(body['errorCode'])
    raise klass.new(message, response_values)
  end
end