Skip to content

Commit

Permalink
Core: Handle IAE in default error handler (apache#9225)
Browse files Browse the repository at this point in the history
  • Loading branch information
nastra authored and lisirrx committed Jan 4, 2024
1 parent f330640 commit edcf59f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ public ErrorResponse parseResponse(int code, String json) {
public void accept(ErrorResponse error) {
switch (error.code()) {
case 400:
if (IllegalArgumentException.class.getSimpleName().equals(error.type())) {
throw new IllegalArgumentException(error.message());
}
throw new BadRequestException("Malformed request: %s", error.message());
case 401:
throw new NotAuthorizedException("Not authorized: %s", error.message());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void createViewErrorCases() {
.withQuery(trino.dialect(), trino.sql())
.withQuery(trino.dialect(), trino.sql())
.create())
.isInstanceOf(Exception.class)
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining(
"Invalid view version: Cannot add multiple queries for dialect trino");
}
Expand Down

0 comments on commit edcf59f

Please sign in to comment.