fix(automation): stop automation when step fails instead of continuing
This commit is contained in:
@@ -64,8 +64,18 @@ export class MockAutomationEngineAdapter implements IAutomationEngine {
|
|||||||
// Use real workflow automation with IRacingSelectorMap
|
// Use real workflow automation with IRacingSelectorMap
|
||||||
const result = await this.browserAutomation.executeStep(currentStep, config as Record<string, unknown>);
|
const result = await this.browserAutomation.executeStep(currentStep, config as Record<string, unknown>);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
console.error(`Step ${currentStep.value} (${getStepName(currentStep.value)}) failed:`, result.error);
|
const errorMessage = `Step ${currentStep.value} (${getStepName(currentStep.value)}) failed: ${result.error}`;
|
||||||
// Continue anyway for now - in production we might want to pause or retry
|
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 {
|
} else {
|
||||||
// Fallback for adapters without executeStep (e.g., MockBrowserAutomationAdapter)
|
// Fallback for adapters without executeStep (e.g., MockBrowserAutomationAdapter)
|
||||||
|
|||||||
Reference in New Issue
Block a user