eric-maynard commented on code in PR #1298: URL: https://github.com/apache/polaris/pull/1298#discussion_r2029949193
########## service/common/src/main/java/org/apache/polaris/service/catalog/common/CatalogHandler.java: ########## @@ -366,4 +349,24 @@ protected void authorizeRenameTableLikeOperationOrThrow( initializeCatalog(); } + + /** + * Helper function for when a TABLE_LIKE entity is not found so we want to throw the appropriate + * exception. Used in Iceberg APIs, so the Iceberg messages cannot be changed. + * + * @param subType The subtype of the entity that the exception should report doesn't exist + */ + public static void throwNotFoundException( + TableIdentifier identifier, PolarisEntitySubType subType) { + switch (subType) { + case ICEBERG_TABLE: + throw new NoSuchTableException("Table does not exist: %s", identifier); + case ICEBERG_VIEW: + throw new NoSuchViewException("View does not exist: %s", identifier); + case GENERIC_TABLE: + throw new NoSuchTableException("Generic table does not exist: %s", identifier); + default: + throw new NoSuchTableException("Entity does not exist: %s", subType); Review Comment: I think that's a better message, and with the method renamed that's probably more clear. However I am a little worried that we can't differentiate from the `ICEBERG_TABLE` branch in that case -- 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...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org