Simplify failure handling

This commit is contained in:
2025-11-01 19:28:20 +09:00
parent 821eeb41ae
commit 737e581f75
5 changed files with 19 additions and 21 deletions

View File

@ -1,4 +1,5 @@
using Hcs.Broker;
using Hcs.Broker.Api.Request.Adapter;
using Hcs.WebApp.Data.Hcs;
namespace Hcs.WebApp.BackgroundServices.ResultGetters
@ -9,6 +10,15 @@ namespace Hcs.WebApp.BackgroundServices.ResultGetters
protected readonly IServiceScope scope = scope;
protected readonly Operation operation = operation;
public abstract Task<ResultGetterResponse> GetAsync();
public abstract Task<bool> GetAsync();
protected Exception Failure(IErrorMessage? errorMessage)
{
if (errorMessage != null)
{
return new Exception($"{errorMessage.ErrorCode} - {errorMessage.Description}");
}
return new Exception("Критическая ошибка");
}
}
}