public async Task <IErrorSafeResponse <T> > ExecuteAsync <T>(Func <Task <T> > action) { try { var value = await action.Invoke(); return(ErrorSafeResponse.Succeed(value)); } catch (Exception e) { logger?.Error(e, e.Message); return(ErrorSafeResponse.Failed <T>()); } }
public async Task <IErrorSafeResponse> ExecuteAsync(Func <Task> action) { try { await action.Invoke(); return(ErrorSafeResponse.Succeed()); } catch (Exception e) { logger?.Error(e, e.Message); return(ErrorSafeResponse.Failed()); } }