Skip to content

Commit fdcb28e

Browse files
author
sathish Ramesh
committed
fix: handle external timeout error with status code 531
1 parent 260c7da commit fdcb28e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

http/src/main/java/com/mx/path/connect/http/HttpClientFilter.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class HttpClientFilter extends RequestFilterBase {
6868
* instead of converting it to a String.
6969
*/
7070
private static final List<String> RAW_BODY_CONTENT_TYPE_HINTS = Arrays.asList("image", "pdf", "msword");
71-
private static final int HTTP_STATUS_EXTERNAL_TIMEOUT = 531;
7271

7372
private static GsonBuilder gsonBuilder = new GsonBuilder();
7473
private static final Gson GSON = gsonBuilder
@@ -162,14 +161,11 @@ public final void execute(Request request, Response response) {
162161
response.finish();
163162
}
164163
} catch (ConnectTimeoutException e) {
165-
httpResponse.setStatus(HttpStatus.valueOf(HTTP_STATUS_EXTERNAL_TIMEOUT));
166-
throw new ConnectException("Connection timeout: " + e.getMessage(), e);
164+
throw new HttpClientConnectException("Connection Timeout Exception", e);
167165
} catch (SocketTimeoutException e) {
168-
httpResponse.setStatus(HttpStatus.valueOf(HTTP_STATUS_EXTERNAL_TIMEOUT));
169-
throw new ConnectException("Read timeout: " + e.getMessage(), e);
166+
throw new HttpClientConnectException("Read Timeout Exception", e);
170167
} catch (NoHttpResponseException e) {
171-
httpResponse.setStatus(HttpStatus.valueOf(HTTP_STATUS_EXTERNAL_TIMEOUT));
172-
throw new ConnectException("Target server failed to respond: " + e.getMessage(), e);
168+
throw new HttpClientConnectException("Target server failed to response", e);
173169
} catch (SSLHandshakeException e) {
174170
throw new HttpClientConnectException("SSL handshake failed", e);
175171
} catch (SSLException e) {

0 commit comments

Comments
 (0)