           )
         )
       else
-        throw Error('ACS method not supported')
+        throw new Error('ACS method not supported')
     else if cwmpRequest.methodResponse?
       taskId = cwmpRequest.id
 

    else if isTaskExpired(task)
      util.log("#{currentRequest.deviceId}: Task is expired #{task.name}(#{task._id})")
      db.tasksCollection.remove({'_id' : mongodb.ObjectID(String(task._id))}, {safe: true}, (err, removed) ->
        throw new Error(err) if err?
        nextTask(currentRequest)
      )
    else


  if Object.keys(updates).length > 0 or Object.keys(deletes).length > 0
    db.devicesCollection.update({'_id' : currentRequest.deviceId}, {'$set' : updates, '$unset' : deletes}, {}, (err, count) ->
      throw err if err
      # Clear aliases cache if there's a new aliased parameter that has not been included in aliases cache
      if newAliases?.length
        db.redisClient.get('aliases', (err, res) ->
          throw err if err
          return if not res?
          aliases = JSON.parse(res)
          for a in newAliases
            if not aliases[a]?
              db.redisClient.del('aliases', (err, res) ->
