diff --git a/backend/api/Services/IsarService.cs b/backend/api/Services/IsarService.cs index b5862e6fa..076be91fb 100644 --- a/backend/api/Services/IsarService.cs +++ b/backend/api/Services/IsarService.cs @@ -30,12 +30,21 @@ public async Task StartMission(Robot robot, MissionRun missionRun) mission_definition = new IsarMissionDefinition(missionRun, includeStartPose: missionRun.MissionRunType == MissionRunType.Localization) }; - var response = await CallApi( - HttpMethod.Post, - robot.IsarUri, - "schedule/start-mission", - missionDefinition - ); + HttpResponseMessage? response; + try + { + response = await CallApi( + HttpMethod.Post, + robot.IsarUri, + "schedule/start-mission", + missionDefinition + ); + } + catch (Exception e) + { + logger.LogError("Encountered an exception when making an API call to ISAR: {Message}", e.Message); + throw new IsarCommunicationException(e.Message); + } if (!response.IsSuccessStatusCode) { diff --git a/backend/api/Services/MissionSchedulingService.cs b/backend/api/Services/MissionSchedulingService.cs index eac7c87c9..a7150ccf5 100644 --- a/backend/api/Services/MissionSchedulingService.cs +++ b/backend/api/Services/MissionSchedulingService.cs @@ -151,11 +151,11 @@ or MissionRunNotFoundException { logger.LogError( ex, - "Mission run {MissionRunId} was not started successfully due to {ErrorMessage}", + "Mission run {MissionRunId} was not started successfully. {ErrorMessage}", missionRun.Id, ex.Message ); - await missionRunService.SetMissionRunToFailed(missionRun.Id, $"Mission run '{missionRun.Id}' was not started successfully due to '{ex.Message}'"); + await missionRunService.SetMissionRunToFailed(missionRun.Id, $"Mission run '{missionRun.Id}' was not started successfully. '{ex.Message}'"); } }