Skip to content

Commit

Permalink
Fix: do not double-wrap OpenSearchException.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Jan 11, 2023
1 parent f1fbe83 commit 2135314
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ private <RequestT> SdkHttpFullRequest prepareRequest(
}
applyOptionsHeaders(req, transportOptions);
applyOptionsHeaders(req, options);

if (endpoint.hasRequestBody() && body != null) {
req.putHeader("Content-Type", body.getContentType());
String encoding = body.getContentEncoding();
Expand Down Expand Up @@ -456,6 +457,8 @@ private <ResponseT, ErrorT> ResponseT parseResponse(
ErrorT error = errorDeserializer.deserialize(parser, mapper);
throw new OpenSearchException((ErrorResponse) error);
}
} catch (OpenSearchException e) {
throw e;
} catch (Exception e) {
// can't parse the error - use a general exception
ErrorCause.Builder cause = new ErrorCause.Builder();
Expand Down

0 comments on commit 2135314

Please sign in to comment.