From ed675567422040aa5f5325299ffb72ac3cb3612f Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Tue, 5 Dec 2023 14:05:51 +0500 Subject: [PATCH] Add ReportService.EnqueueCreateReportWork Add OnError handler --- AsbCloudInfrastructure/Services/ReportService.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index a4f659f8..e4094c34 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -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