henriquejsza opened a new pull request, #14386:
URL: https://github.com/apache/gravitino/pull/14386
### What changes were proposed in this pull request?
Add two entries to `IcebergExceptionMapper.EXCEPTION_ERROR_CODES`:
- `org.apache.iceberg.exceptions.NotFoundException` -> 404 (referenced by
its fully
qualified name because its simple name clashes with the already-imported
`javax.ws.rs.NotFoundException`).
- `java.lang.IllegalStateException` -> 400.
A unit test in `TestIcebergExceptionMapper` now asserts both statuses.
### Why are the changes needed?
The Iceberg REST service answered two client errors with HTTP 500, so
clients treat a
bad request as a server failure and retry it. `getErrorCode` looks up the
exact
exception class in the table and falls back to 500. Two Iceberg exceptions
were
missing:
- The table mapped `NotFoundException` to 404, but the imported class was
`javax.ws.rs.NotFoundException`, so Iceberg's own `NotFoundException`
(thrown, for
example, by `registerTable` with `overwrite` and a `metadata-location`
that does not
exist) fell through to 500.
- `IllegalStateException`, which Iceberg throws when a schema is invalid for
the
table's format version (e.g. a v3-only type on a v2 table), was not mapped
and
returned 500.
Both requests now return a 4xx with the Iceberg error model, leaving 500 for
server
failures.
Fixes #14302
### Does this PR introduce _any_ user-facing change?
Yes. The Iceberg REST service now returns 404 for Iceberg's
`NotFoundException` and
400 for `IllegalStateException` instead of 500. No API or property changes.
### How was this patch tested?
Added assertions to `TestIcebergExceptionMapper.testIcebergExceptionMapper`
for
Iceberg's `NotFoundException` (404) and `IllegalStateException` (400), and
ran the
module test suite.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]