forked from ddrilling/AsbCloudServer
GetDatesRange Fix handle exception "Well id: {idWell} does not contain telemetry."
This commit is contained in:
parent
41816719b9
commit
9b06438935
@ -332,7 +332,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
throw new Exception($"Well id: {idWell} does not exist.");
|
||||
|
||||
if (well.IdTelemetry is null)
|
||||
throw new Exception($"Well id: {idWell} does not contain telemetry.");
|
||||
throw new KeyNotFoundException($"Well id: {idWell} does not contain telemetry.");
|
||||
|
||||
return telemetryService.GetDatesRange((int)well.IdTelemetry);
|
||||
}
|
||||
|
@ -115,11 +115,15 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
|
||||
if (!isCompanyOwnsWell)
|
||||
return Forbid();
|
||||
|
||||
var dataDatesRange = wellService.GetDatesRange(idWell);
|
||||
|
||||
return Ok(dataDatesRange);
|
||||
try
|
||||
{
|
||||
var dataDatesRange = wellService.GetDatesRange(idWell);
|
||||
return Ok(dataDatesRange);
|
||||
}
|
||||
catch(KeyNotFoundException)
|
||||
{
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user