exception handling needs to encapsulate entire method
This commit is contained in:
@ -113,6 +113,8 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartJob(int jobId)
|
private async Task StartJob(int jobId)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Job _job = await JobService.GetJobAsync(jobId);
|
Job _job = await JobService.GetJobAsync(jobId);
|
||||||
if (!_job.IsEnabled)
|
if (!_job.IsEnabled)
|
||||||
@ -120,8 +122,6 @@ else
|
|||||||
AddModuleMessage(Localizer["Message.Job.Disabled"], MessageType.Warning);
|
AddModuleMessage(Localizer["Message.Job.Disabled"], MessageType.Warning);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
await JobService.StartJobAsync(jobId);
|
await JobService.StartJobAsync(jobId);
|
||||||
await logger.LogInformation("Job Started {JobId}", jobId);
|
await logger.LogInformation("Job Started {JobId}", jobId);
|
||||||
@ -129,13 +129,13 @@ else
|
|||||||
_jobs = await JobService.GetJobsAsync();
|
_jobs = await JobService.GetJobsAsync();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Starting Job {JobId} {Error}", jobId, ex.Message);
|
await logger.LogError(ex, "Error Starting Job {JobId} {Error}", jobId, ex.Message);
|
||||||
AddModuleMessage(Localizer["Error.Job.Start"], MessageType.Error);
|
AddModuleMessage(Localizer["Error.Job.Start"], MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private async Task StopJob(int jobId)
|
private async Task StopJob(int jobId)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user