Add ReportService.EnqueueCreateReportWork Add OnError handler

This commit is contained in:
ngfrolov 2023-12-05 14:05:51 +05:00
parent 39de15e1ba
commit ed67556742
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7

View File

@ -98,6 +98,17 @@ namespace AsbCloudInfrastructure.Services
};
var work = Work.CreateByDelegate(workId, workAction);
work.OnErrorAsync = (message, exception, token) => Task.Run(() => progressHandler.Invoke(new
{
Operation = "error",
Progress = 100f,
Message = string.IsNullOrEmpty(message)
? exception.Message
: message,
Exception = exception,
}, workId)
, token);
backgroundWorkerService.Enqueue(work);
progressHandler.Invoke(new ReportProgressDto