This repository was archived by the owner on Sep 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/main/java/com/marklogic/rest/util Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import org .slf4j .Logger ;
6
6
import org .slf4j .LoggerFactory ;
7
+ import org .springframework .http .HttpStatus ;
7
8
import org .springframework .http .client .ClientHttpResponse ;
8
9
import org .springframework .web .client .DefaultResponseErrorHandler ;
9
10
import org .springframework .web .client .HttpClientErrorException ;
@@ -18,8 +19,14 @@ public void handleError(ClientHttpResponse response) throws IOException {
18
19
try {
19
20
super .handleError (response );
20
21
} catch (HttpClientErrorException | HttpServerErrorException ex ) {
21
- if (logger .isErrorEnabled ()) {
22
- logger .error ("Logging HTTP response body to assist with debugging: " + ex .getResponseBodyAsString ());
22
+ String message = "Logging HTTP response body to assist with debugging: " + ex .getResponseBodyAsString ();
23
+ if (HttpStatus .SERVICE_UNAVAILABLE .equals (ex .getStatusCode ())) {
24
+ if (logger .isDebugEnabled ()) {
25
+ logger .debug (message );
26
+ }
27
+ }
28
+ else if (logger .isErrorEnabled ()) {
29
+ logger .error (message );
23
30
}
24
31
throw ex ;
25
32
}
You can’t perform that action at this time.
0 commit comments