From a5c100f1744919387846a38894550204805d2db7 Mon Sep 17 00:00:00 2001 From: Rohit Date: Thu, 20 Feb 2025 13:18:03 +0530 Subject: [PATCH] fix: add error handling for optimize --- server/src/workflow-management/selector.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 3f44a01e..20a6a529 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -1092,12 +1092,16 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { newPath.splice(i, 1); const newPathKey = selector(newPath); if (scope.visited.has(newPathKey)) { - return; + continue; } - if (unique(newPath) && same(newPath, input)) { - yield newPath; - scope.visited.set(newPathKey, true); - yield* optimize(newPath, input, scope); + try { + if (unique(newPath) && same(newPath, input)) { + yield newPath; + scope.visited.set(newPathKey, true); + yield* optimize(newPath, input, scope); + } + } catch (e: any) { + continue; } } }