Skip to content

Commit 1221573

Browse files
authored
fix: Fix login error handling when auth service is not available (#1579)
Signed-off-by: at670475 <andrea.tabone@broadcom.com>
1 parent d7237ce commit 1221573

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

security-service-client-spring/src/main/java/org/zowe/apiml/security/client/handler/RestResponseHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void handleBadResponse(@NotNull Exception exception, ErrorType errorType,
4949
throw new GatewayNotAvailableException(ErrorType.GATEWAY_NOT_AVAILABLE.getDefaultMessage(), exception);
5050
} else if (exception instanceof HttpServerErrorException) {
5151
HttpServerErrorException hseException = (HttpServerErrorException) exception;
52-
if (hseException.getStatusCode().equals(HttpStatus.SERVICE_UNAVAILABLE)) {
52+
if (hseException.getStatusCode().equals(HttpStatus.SERVICE_UNAVAILABLE) || hseException.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
5353
throw new ServiceNotAccessibleException(ErrorType.SERVICE_UNAVAILABLE.getDefaultMessage(), exception);
5454
} else {
5555
throw hseException;

security-service-client-spring/src/test/java/org/zowe/apiml/security/client/handler/RestResponseHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void handleBadResponseWithServiceUnavailable() {
129129
@Test
130130
void handleBadResponseWithHttpServerError() {
131131
HttpServerErrorException exception = new HttpServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Some server error");
132-
assertThrows(HttpServerErrorException.class, () -> {
132+
assertThrows(ServiceNotAccessibleException.class, () -> {
133133
handler.handleBadResponse(exception, null, GENERIC_LOG_MESSAGE, LOG_PARAMETERS);
134134
});
135135
}

0 commit comments

Comments
 (0)