fix(automation): stop automation when step fails instead of continuing

This commit is contained in:
2025-11-22 15:04:05 +01:00
parent c0e0e00c4c
commit 2b0e7b5976

View File

@@ -64,8 +64,18 @@ export class MockAutomationEngineAdapter implements IAutomationEngine {
// Use real workflow automation with IRacingSelectorMap
const result = await this.browserAutomation.executeStep(currentStep, config as Record<string, unknown>);
if (!result.success) {
console.error(`Step ${currentStep.value} (${getStepName(currentStep.value)}) failed:`, result.error);
// Continue anyway for now - in production we might want to pause or retry
const errorMessage = `Step ${currentStep.value} (${getStepName(currentStep.value)}) failed: ${result.error}`;
console.error(errorMessage);
// Stop automation and mark session as failed
if (this.automationInterval) {
clearInterval(this.automationInterval);
this.automationInterval = null;
}
session.fail(errorMessage);
await this.sessionRepository.update(session);
return;
}
} else {
// Fallback for adapters without executeStep (e.g., MockBrowserAutomationAdapter)