Skip to content

Commit fb5763e

Browse files
fix: avoid using throws in logic - moving files to poison container is now explicit
1 parent aceed6d commit fb5763e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • application/CohortManager/src/Functions/NemsSubscriptionService/ProcessNemsUpdate

application/CohortManager/src/Functions/NemsSubscriptionService/ProcessNemsUpdate/ProcessNemsUpdate.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ public async Task Run([BlobTrigger("nems-updates/{name}", Connection = "nemsmesh
7070

7171
if (nhsNumber == null)
7272
{
73-
_logger.LogInformation("There is no NHS number, unable to continue.");
74-
throw new InvalidDataException("No NHS number found"); // Force poison container
73+
_logger.LogError("No NHS number found in file {FileName}. Moving to poison container.", name);
74+
await CopyToPoisonContainer(name);
75+
return;
7576
}
7677

7778
if (!ValidationHelper.ValidateNHSNumber(nhsNumber))
7879
{
79-
_logger.LogError("There was a problem parsing the NHS number from blob store in the ProcessNemsUpdate function");
80-
throw new InvalidDataException("Invalid NHS Number");
80+
_logger.LogError("There was a problem validating the NHS number from blob store in the ProcessNemsUpdate function for file {FileName}. Moving to poison container.", name);
81+
await CopyToPoisonContainer(name);
82+
return;
8183
}
8284
nhsNumberLong = long.Parse(nhsNumber!);
8385

0 commit comments

Comments
 (0)