Skip to content

Conversation

DerGut
Copy link

@DerGut DerGut commented Aug 10, 2025

I ran a simple example without having setup my catalog URI correctly. This code snippet:

catalog, err := rest.NewCatalog(context.TODO(), "test", "http://localhost:8181")
if err != nil {
  slog.Error("Failed to create iceberg catalog", "error", err)
  return
}

errored with

2025/08/10 20:50:39 ERROR Failed to create iceberg catalog error=": "

Turns out, when the catalog is returning a non-200 response, we never check for decoding errors which is why we get the unhelpful ": " error.

In this PR, I've refactored the func handleNon200 a little bit to accommodate this. The code is now instead returning something like "decoding json response: EOF: REST error: server error". I have a corresponding commit that shows this new behavior, it's not yet included in this PR because it's a bit clunky.

Signed-off-by: DerGut <jannik.steinmann@gmx.de>
Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for this please?

Comment on lines +339 to +344
baseErr := errFromStatusCode(rsp.StatusCode)
if overrides != nil {
if override, ok := overrides[rsp.StatusCode]; ok {
baseErr = override
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably invert this. First check for the override, and if there's no override then use errFromStatusCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants