Skip to content

REST: Map commit_table 404 and 503 responses like Java - #4465

Merged
Fokko merged 1 commit into
apache:mainfrom
1yangsh:rest-commit-table-error-mapping
Nov 21, 2026
Merged

Fokko merged 1 commit into
apache:mainfrom
1yangsh:rest-commit-table-error-mapping

Conversation

@1yangsh

@1yangsh 1yangsh commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

RestCatalog.commit_table documents NoSuchTableError for a missing table, but a 404 was not in its error map, so it surfaced as a generic RESTError.

A 503 raised ServiceUnavailableError. Java's ErrorHandlers.CommitErrorHandler treats 500, 502, 503 and 504 as CommitStateUnknownException, since the server may have applied the commit. 503 was added there in apache/iceberg#13619.

This change maps 404 to NoSuchTableError and 503 to CommitStateUnknownException, matching Java.

Are these changes tested?

Yes. test_commit_table_error_mapping in tests/catalog/test_rest.py checks the exception raised for 404, 409, 500, 502, 503 and 504.

Are there any user-facing changes?

Yes:

  • A 404 on commit now raises NoSuchTableError instead of RESTError.
  • A 503 on commit now raises CommitStateUnknownException instead of ServiceUnavailableError.

AI disclosure: an AI coding assistant helped draft the change and the tests. The mapping was checked against Java's ErrorHandlers, and the catalog tests and linters were run before submitting.

commit_table documents NoSuchTableError for a missing table, but a 404
was not mapped and surfaced as a generic RESTError. A 503 raised
ServiceUnavailableError, while Java's CommitErrorHandler treats 500,
502, 503 and 504 as CommitStateUnknownException, since the server may
have applied the commit.

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding these @1yangsh

@Fokko
Fokko added this pull request to the merge queue Nov 21, 2026
Merged via the queue into apache:main with commit f91ce53 Nov 21, 2026
20 checks passed
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