exception handling needs to encapsulate entire method

This commit is contained in:
sbwalker
2025-09-05 11:13:21 -04:00
parent c698188901
commit e913c10d5b

View File

@ -113,6 +113,8 @@ else
}
private async Task StartJob(int jobId)
{
try
{
Job _job = await JobService.GetJobAsync(jobId);
if (!_job.IsEnabled)
@ -120,8 +122,6 @@ else
AddModuleMessage(Localizer["Message.Job.Disabled"], MessageType.Warning);
}
else
{
try
{
await JobService.StartJobAsync(jobId);
await logger.LogInformation("Job Started {JobId}", jobId);
@ -129,13 +129,13 @@ else
_jobs = await JobService.GetJobsAsync();
StateHasChanged();
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Starting Job {JobId} {Error}", jobId, ex.Message);
AddModuleMessage(Localizer["Error.Job.Start"], MessageType.Error);
}
}
}
private async Task StopJob(int jobId)
{