Simplify failure handling
This commit is contained in:
@ -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("Критическая ошибка");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user