Skip to content

Commit

Permalink
[Improve][Elasticsearch] Truncate the exception message body for requ…
Browse files Browse the repository at this point in the history
…est errors
  • Loading branch information
hailin0 committed Dec 10, 2024
1 parent b74adb1 commit 3669b19
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,16 @@ public BulkResponse bulk(String requestBody) {
throw new ElasticsearchConnectorException(
ElasticsearchConnectorErrorCode.BULK_RESPONSE_ERROR,
String.format(
"bulk es response status code=%d,request boy=%s",
response.getStatusLine().getStatusCode(), requestBody));
"bulk es response status=%s,request body=%s",
response,
requestBody.substring(0, Math.min(1000, requestBody.length()))));
}
} catch (IOException e) {
throw new ElasticsearchConnectorException(
ElasticsearchConnectorErrorCode.BULK_RESPONSE_ERROR,
String.format("bulk es error,request boy=%s", requestBody),
String.format(
"bulk es error,request body=%s",
requestBody.substring(0, Math.min(1000, requestBody.length()))),
e);
}
}
Expand Down

0 comments on commit 3669b19

Please sign in to comment.