diff --git a/src/SIL.Machine.AspNetCore/Services/ClearMLNmtEngineBuildJob.cs b/src/SIL.Machine.AspNetCore/Services/ClearMLNmtEngineBuildJob.cs index 89630d7dc..918f40b90 100644 --- a/src/SIL.Machine.AspNetCore/Services/ClearMLNmtEngineBuildJob.cs +++ b/src/SIL.Machine.AspNetCore/Services/ClearMLNmtEngineBuildJob.cs @@ -212,14 +212,17 @@ await _engines.UpdateAsync( } catch (Exception e) { + _logger.LogError(0, e, $"Build faulted ({buildId}) because of exception {e.GetType().Name}:{e.Message}."); + try { await _sharedFileService.DeleteAsync($"builds/{buildId}/", CancellationToken.None); } - catch (HttpRequestException) + catch (Exception e2) { - _logger.LogError("Unable to access S3 bucket. Likely, the AWS credentials are invalid."); - throw; + _logger.LogError( + $"Unable to access S3 bucket to delete clearml job {buildId} because it threw the exception {e2.GetType().Name}:{e2.Message}." + ); } await _engines.UpdateAsync( @@ -233,7 +236,6 @@ await _engines.UpdateAsync( ); await _platformService.BuildFaultedAsync(buildId, e.Message, CancellationToken.None); - _logger.LogError(0, e, "Build faulted ({0})", buildId); throw; } }