From 940d04e5b2eb59ced937e6bc6a4fb204a9f86267 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 12 Oct 2024 22:12:15 +0530 Subject: [PATCH] feat: return result.interpretationInfo from executeRun --- server/src/api/record.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/api/record.ts b/server/src/api/record.ts index 578760a6..4fd4f2bd 100644 --- a/server/src/api/record.ts +++ b/server/src/api/record.ts @@ -245,23 +245,25 @@ async function createWorkflowAndStoreMetadata(id: string, userId: string) { async function readyForRunHandler(browserId: string, id: string) { try { - const interpretation = await executeRun(id); + const result = await executeRun(id); - if (interpretation) { + if (result && result.success) { logger.log('info', `Interpretation of ${id} succeeded`); + return result.interpretationInfo; } else { logger.log('error', `Interpretation of ${id} failed`); await destroyRemoteBrowser(browserId); + return null; } - resetRecordingState(browserId, id); - } catch (error: any) { logger.error(`Error during readyForRunHandler: ${error.message}`); await destroyRemoteBrowser(browserId); + return null; } } + function resetRecordingState(browserId: string, id: string) { browserId = ''; id = '';