nastra commented on code in PR #8909: URL: https://github.com/apache/iceberg/pull/8909#discussion_r1375097118
########## nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java: ########## @@ -355,21 +384,34 @@ public void renameTable(TableIdentifier from, TableIdentifier to) { // and removed by another. throw new RuntimeException( String.format( - "Cannot rename table '%s' to '%s': " + "ref '%s' no longer exists.", - from.name(), to.name(), getRef().getName()), + "Cannot rename %s '%s' to '%s': ref '%s' no longer exists.", + contentType, from, to, getRef().getName()), e); } catch (BaseNessieClientServerException e) { throw new CommitFailedException( e, - "Cannot rename table '%s' to '%s': " + "the current reference is not up to date.", - from.name(), - to.name()); + "Cannot rename %s '%s' to '%s': the current reference is not up to date.", + contentType, + from, + to); } catch (HttpClientException ex) { // Intentionally catch all nessie-client-exceptions here and not just the "timeout" variant // to catch all kinds of network errors (e.g. connection reset). Network code implementation // details and all kinds of network devices can induce unexpected behavior. So better be // safe than sorry. throw new CommitStateUnknownException(ex); + } catch (NessieBadRequestException ex) { + if (ex.getMessage().contains("already exists with content ID")) { + if (isView) { Review Comment: I think something like this would be better here: ``` String errorMsg = isView ? "...<view error msg>.." : "...<table error msg>..." throw new AlreadyExistsException(errorMsg) ``` -- 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