Skip to content

Commit

Permalink
[Backport 2.x] Unify internal OpenSearch exceptions with returned sta…
Browse files Browse the repository at this point in the history
…tus code (#3072)

(cherry picked from commit 4c44f56)

Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 79f9be0 commit 0ca3f85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public void invalidCursorIdNotDecodable() throws IOException {

JSONObject resp = new JSONObject(TestUtils.getResponseBody(response));
assertThat(resp.getInt("status"), equalTo(400));
assertThat(resp.query("/error/type"), equalTo("illegal_argument_exception"));
assertThat(resp.query("/error/type"), equalTo("IllegalArgumentException"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

public class OpenSearchErrorMessage extends ErrorMessage<OpenSearchException> {

OpenSearchErrorMessage(OpenSearchException exception, int status) {
super(exception, status);
OpenSearchErrorMessage(OpenSearchException exception, int defaultStatus) {
super(exception, exception.status() != null ? exception.status().getStatus() : defaultStatus);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
/** OpenSearch Error Message. */
public class OpenSearchErrorMessage extends ErrorMessage {

OpenSearchErrorMessage(OpenSearchException exception, int status) {
super(exception, status);
OpenSearchErrorMessage(OpenSearchException exception, int defaultStatus) {
super(exception, exception.status() != null ? exception.status().getStatus() : defaultStatus);
}

@Override
Expand Down

0 comments on commit 0ca3f85

Please sign in to comment.