Skip to content

Commit 9c14598

Browse files
author
Adrian Clay
authored
Also clear the ehrExtractStatus.error field before resending EHR (#1014)
When an error happens on the adaptor when fetching the Structured Record, the EHR error field will be populated. Clear this, as otherwise the ProcessFailureHandlingService.hasProcessFailed check will return true.
1 parent 266b253 commit 9c14598

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ private EhrExtractStatus prepareEhrExtractStatusForNewResend(EhrExtractStatus eh
103103
ehrExtractStatus.setGpcAccessDocument(null);
104104
ehrExtractStatus.setEhrContinue(null);
105105
ehrExtractStatus.setEhrReceivedAcknowledgement(null);
106+
ehrExtractStatus.setError(null);
106107

107108
return ehrExtractStatus;
108109
}

service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendControllerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void When_AnEhrExtractHasFailed_Expect_GetGpcStructuredTaskScheduledAndEhrExtrac
102102
ehrExtractStatus.setEhrContinue(EhrExtractStatus.EhrContinue.builder().build());
103103
ehrExtractStatus.setGpcAccessDocument(EhrExtractStatus.GpcAccessDocument.builder().build());
104104
ehrExtractStatus.setCreated(FIVE_DAYS_AGO);
105+
ehrExtractStatus.setError(EhrExtractStatus.Error.builder().message("Failed to download EHR").build());
105106

106107
when(ehrExtractStatusRepository.findByConversationId(CONVERSATION_ID)).thenReturn(Optional.of(ehrExtractStatus));
107108

@@ -122,7 +123,8 @@ void When_AnEhrExtractHasFailed_Expect_GetGpcStructuredTaskScheduledAndEhrExtrac
122123
() -> assertNull(ehrExtractStatus.getEhrContinue()),
123124
() -> assertNull(ehrExtractStatus.getAckPending()),
124125
() -> assertNull(ehrExtractStatus.getEhrReceivedAcknowledgement()),
125-
() -> assertNull(ehrExtractStatus.getGpcAccessDocument())
126+
() -> assertNull(ehrExtractStatus.getGpcAccessDocument()),
127+
() -> assertNull(ehrExtractStatus.getError())
126128
);
127129
}
128130

0 commit comments

Comments
 (0)