Detect the "504 Gateway Time-out" error from Sushilite-R5 and provide a mention to it, in the response-body.

This commit is contained in:
Lampros Smyrnaios 2023-03-29 12:04:34 +03:00
parent 97e85c2a75
commit 54ebb35161
1 changed files with 5 additions and 1 deletions

View File

@ -73,7 +73,11 @@ public class SushiliteR5ServiceImpl implements SushiliteR5Service {
new ParameterizedTypeReference<Object>() {});
} catch (RestClientException rce) {
String errorMsg = "Failed to get a response from sushiliteR5!";
logger.error(errorMsg + " URI was:\n" + uri + "\n" + rce.getMessage());
String message = rce.getMessage();
if ( (message != null) && message.contains("504 Gateway Time-out") ) // In this case the parsing-exception is thrown before we get to check the response code..
errorMsg += " Reason: 504 Gateway Time-out";
logger.error(errorMsg + " URI was:\n" + uri + "\n" + message);
return ResponseEntity.internalServerError().body(errorMsg);
}