feat: return result.interpretationInfo from executeRun

This commit is contained in:
karishmas6
2024-10-12 22:12:15 +05:30
parent 88d9a927b6
commit 940d04e5b2

View File

@@ -245,23 +245,25 @@ async function createWorkflowAndStoreMetadata(id: string, userId: string) {
async function readyForRunHandler(browserId: string, id: string) { async function readyForRunHandler(browserId: string, id: string) {
try { try {
const interpretation = await executeRun(id); const result = await executeRun(id);
if (interpretation) { if (result && result.success) {
logger.log('info', `Interpretation of ${id} succeeded`); logger.log('info', `Interpretation of ${id} succeeded`);
return result.interpretationInfo;
} else { } else {
logger.log('error', `Interpretation of ${id} failed`); logger.log('error', `Interpretation of ${id} failed`);
await destroyRemoteBrowser(browserId); await destroyRemoteBrowser(browserId);
return null;
} }
resetRecordingState(browserId, id);
} catch (error: any) { } catch (error: any) {
logger.error(`Error during readyForRunHandler: ${error.message}`); logger.error(`Error during readyForRunHandler: ${error.message}`);
await destroyRemoteBrowser(browserId); await destroyRemoteBrowser(browserId);
return null;
} }
} }
function resetRecordingState(browserId: string, id: string) { function resetRecordingState(browserId: string, id: string) {
browserId = ''; browserId = '';
id = ''; id = '';