From f45197ad3f9758a75de621c75bfa05bbed835b79 Mon Sep 17 00:00:00 2001 From: osamo-oas Date: Wed, 27 Jul 2022 15:50:59 +0100 Subject: [PATCH 1/2] add msg for 404 error --- .../delta/service/api/BaseApiClientServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java b/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java index 314d07c..52104fd 100644 --- a/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java +++ b/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java @@ -3,7 +3,6 @@ import java.util.HashMap; import java.util.Map; import org.springframework.http.HttpStatus; -import org.springframework.web.server.ResponseStatusException; import uk.gov.companieshouse.api.error.ApiErrorResponseException; import uk.gov.companieshouse.api.handler.Executor; import uk.gov.companieshouse.api.handler.exception.URIValidationException; @@ -56,6 +55,11 @@ public ApiResponse executeOp(final String logContext, "400 BAD_REQUEST response received from disqualified-officers-data-api"; logger.errorContext(logContext, msg, ex, logMap); throw new NonRetryableErrorException(msg, ex); + } else if (ex.getStatusCode() == HttpStatus.NOT_FOUND.value() + && operationName.equals("DELETE")) { + String msg = + "404 NOT_FOUND response received from disqualified-officers-data-api"; + throw new RetryableErrorException(msg); } // any other client or server status is retryable From 17aa7c799eaaa9fc8e6b089080452080ae2a2c1a Mon Sep 17 00:00:00 2001 From: osamo-oas Date: Wed, 27 Jul 2022 16:07:21 +0100 Subject: [PATCH 2/2] change string check --- .../delta/service/api/BaseApiClientServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java b/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java index 52104fd..5a6c243 100644 --- a/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java +++ b/src/main/java/uk/gov/companieshouse/disqualifiedofficers/delta/service/api/BaseApiClientServiceImpl.java @@ -56,7 +56,7 @@ public ApiResponse executeOp(final String logContext, logger.errorContext(logContext, msg, ex, logMap); throw new NonRetryableErrorException(msg, ex); } else if (ex.getStatusCode() == HttpStatus.NOT_FOUND.value() - && operationName.equals("DELETE")) { + && operationName.equals("deleteDisqualification")) { String msg = "404 NOT_FOUND response received from disqualified-officers-data-api"; throw new RetryableErrorException(msg);