Skip to content

Commit

Permalink
Unify internal OpenSearch exceptions with returned status code (#3068)
Browse files Browse the repository at this point in the history
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
  • Loading branch information
Swiddis authored Oct 12, 2024
1 parent cf1564b commit 4c44f56
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 @@ -393,7 +393,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 4c44f56

Please sign in to comment.