nastra commented on code in PR #7913: URL: https://github.com/apache/iceberg/pull/7913#discussion_r1415576999
########## core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java: ########## @@ -247,8 +247,9 @@ public void createViewErrorCases() { .withQuery(trino.dialect(), trino.sql()) .withQuery(trino.dialect(), trino.sql()) .create()) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("Invalid view version: Cannot add multiple queries for dialect trino"); + .isInstanceOf(Exception.class) Review Comment: I remember I replied to this but somehow can't find where it was. The issue with the REST version is unfortunately that it fails with `org.apache.iceberg.exceptions.BadRequestException: Malformed request: Invalid view version: Cannot add multiple queries for dialect trino` because we're re-applying all changes to the Builder in `CatalogHandlers.createView(...)`: https://github.com/apache/iceberg/blob/f076b4d15822a7b4f9a0d7a0c65ce62682bff109/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L424-L429 That IAE is then converted to a `BadRequestException` in https://github.com/apache/iceberg/blob/ace0b13aa733c750ea8d47adb6a1c27950494ba8/core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java#L204-L205 So I think what we could do is to have ``` if (IllegalArgumentException.class.getSimpleName().equals(error.type())) { throw new IllegalArgumentException(error.message()); } ``` in the `DefaultErrorHandler`. Thoughts? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org