From 02dfe4b5540f38e95dd23488e5ec001018dc22b7 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Wed, 17 Feb 2021 17:54:21 -0800 Subject: [PATCH] Show warning when task name not recognized --- lib/cwmp.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/cwmp.ts b/lib/cwmp.ts index e868f0c..2d81e15 100644 --- a/lib/cwmp.ts +++ b/lib/cwmp.ts @@ -726,7 +726,15 @@ async function nextRpc(sessionContext: SessionContext): Promise { ); break; default: - throw new Error("Task name not recognized"); + if (!sessionContext.doneTasks) sessionContext.doneTasks = []; + sessionContext.doneTasks.push(task._id); + sessionContext.tasks = sessionContext.tasks.filter((t) => t !== task); + + logger.accessWarn({ + sessionContext: sessionContext, + message: "Invalid task", + taskId: task._id, + }); } return nextRpc(sessionContext);