Check import results

This commit is contained in:
2025-08-29 17:37:15 +09:00
parent 46237ab0cd
commit 7ae4858d6a
4 changed files with 41 additions and 25 deletions

View File

@ -1,6 +1,9 @@
using Hcs.Client.Api.Request;
using Hcs.Client.Api.Request.Adapter;
using Hcs.Client.Api.Request.Exception;
using Hcs.Service.Async.HouseManagement;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Hcs.Service.Async.HouseManagement
@ -51,5 +54,29 @@ namespace Hcs.Client.Api.Request.HouseManagement
protected override bool CanBeRestarted => true;
protected override int RestartTimeoutMinutes => 20;
protected getStateResultImportResultCommonResult[] GetCommonResults(IEnumerable<getStateResultImportResult> importResults)
{
var result = new List<getStateResultImportResultCommonResult>();
foreach (var importResult in importResults)
{
importResult.Items.OfType<ErrorMessageType>().ToList().ForEach(error =>
{
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
});
var commonResults = importResult.Items.OfType<getStateResultImportResultCommonResult>();
foreach (var commonResult in commonResults)
{
commonResult.Items.OfType<CommonResultTypeError>().ToList().ForEach(error =>
{
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
});
}
result.AddRange(commonResults);
}
return [.. result];
}
}
}