exception handling needs to encapsulate entire method
This commit is contained in:
@ -114,14 +114,14 @@ else
|
|||||||
|
|
||||||
private async Task StartJob(int jobId)
|
private async Task StartJob(int jobId)
|
||||||
{
|
{
|
||||||
Job _job = await JobService.GetJobAsync(jobId);
|
try
|
||||||
if (!_job.IsEnabled)
|
|
||||||
{
|
{
|
||||||
AddModuleMessage(Localizer["Message.Job.Disabled"], MessageType.Warning);
|
Job _job = await JobService.GetJobAsync(jobId);
|
||||||
}
|
if (!_job.IsEnabled)
|
||||||
else
|
{
|
||||||
{
|
AddModuleMessage(Localizer["Message.Job.Disabled"], MessageType.Warning);
|
||||||
try
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await JobService.StartJobAsync(jobId);
|
await JobService.StartJobAsync(jobId);
|
||||||
await logger.LogInformation("Job Started {JobId}", jobId);
|
await logger.LogInformation("Job Started {JobId}", jobId);
|
||||||
@ -129,11 +129,11 @@ 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);
|
{
|
||||||
AddModuleMessage(Localizer["Error.Job.Start"], MessageType.Error);
|
await logger.LogError(ex, "Error Starting Job {JobId} {Error}", jobId, ex.Message);
|
||||||
}
|
AddModuleMessage(Localizer["Error.Job.Start"], MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user