Skip to content

Commit 5683095

Browse files
committed
Fix error msg when starting mission without tasks
1 parent 15198f5 commit 5683095

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

backend/api/Services/MissionSchedulingService.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,33 @@ public async Task StartNextMissionRunIfSystemIsAvailable(Robot robot)
8888
return;
8989
}
9090

91+
if (missionRun.Tasks.Count == 0)
92+
{
93+
logger.LogWarning(
94+
"MissionRun {RobotName} was not started on robot {RobotId} as the mission has no tasks",
95+
missionRun.Id,
96+
robot.Id
97+
);
98+
try
99+
{
100+
await AbortMissionRun(
101+
missionRun,
102+
$"Mission run {missionRun.Id} aborted: Mission has no tasks"
103+
);
104+
}
105+
catch (RobotNotFoundException)
106+
{
107+
logger.LogError(
108+
"Failed to abort scheduled mission {missionRun.Id} for robot {RobotName} with Id {RobotId}",
109+
missionRun.Id,
110+
robot.Name,
111+
robot.Id
112+
);
113+
}
114+
await StartNextMissionRunIfSystemIsAvailable(robot);
115+
return;
116+
}
117+
91118
missionRun.Tasks = await exclusionAreaService.FilterOutExcludedMissionTasks(
92119
missionRun.Tasks,
93120
missionRun.InstallationCode

0 commit comments

Comments
 (0)