25 lines
811 B
C#
25 lines
811 B
C#
using Hcs.Broker;
|
|
using Hcs.Broker.Api.Request.Adapter;
|
|
using Hcs.WebApp.Data.Hcs;
|
|
|
|
namespace Hcs.WebApp.BackgroundServices.ResultGetters
|
|
{
|
|
public abstract class ResultGetterBase(IClient client, IServiceScope scope, Operation operation) : IResultGetter
|
|
{
|
|
protected readonly IClient client = client;
|
|
protected readonly IServiceScope scope = scope;
|
|
protected readonly Operation operation = operation;
|
|
|
|
public abstract Task<bool> GetAsync();
|
|
|
|
protected Exception Failure(IErrorMessage? errorMessage)
|
|
{
|
|
if (errorMessage != null)
|
|
{
|
|
return new Exception($"{errorMessage.ErrorCode} - {errorMessage.Description}");
|
|
}
|
|
return new Exception("Критическая ошибка");
|
|
}
|
|
}
|
|
}
|