forked from ddrilling/AsbCloudServer
Fix DetectedOperationExportService.ExportAsync exception type/text
This commit is contained in:
parent
fa3de75b85
commit
4c3f638bfb
@ -12,6 +12,7 @@ using AsbCloudApp.Data.DetectedOperation;
|
||||
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
||||
using AsbCloudApp.Repositories;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using AsbCloudApp.Exceptions;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
||||
|
||||
@ -57,21 +58,21 @@ public class DetectedOperationExportService
|
||||
/// <param name="host">хост</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentInvalidException"></exception>
|
||||
public async Task<Stream> ExportAsync(int idWell, string host, CancellationToken cancellationToken)
|
||||
{
|
||||
var well = await dbContext.Wells
|
||||
var well = await dbContext.Set<Well>()
|
||||
.Include(w => w.Cluster)
|
||||
.ThenInclude(c => c.Deposit)
|
||||
.SingleOrDefaultAsync(w => w.Id == idWell, cancellationToken);
|
||||
.FirstOrDefaultAsync(w => w.Id == idWell, cancellationToken);
|
||||
|
||||
if (well is null)
|
||||
throw new ArgumentNullException(nameof(well));
|
||||
throw new ArgumentInvalidException(nameof(idWell), $"Well {idWell} does not exist");
|
||||
|
||||
if (!well.IdTelemetry.HasValue)
|
||||
throw new ArgumentNullException(nameof(well));
|
||||
throw new ArgumentInvalidException(nameof(idWell), $"Well {idWell} has no telemetry");
|
||||
|
||||
var operations = await DetectOperationsAsync(well.IdTelemetry.Value, DateTime.UnixEpoch, cancellationToken);
|
||||
var operations = await DetectOperationsAsync(well.IdTelemetry.Value, DateTime.UnixEpoch, cancellationToken);
|
||||
|
||||
return await GenerateExcelFileStreamAsync(well, host, operations, cancellationToken);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user