lasdf1234 opened a new issue, #14240: URL: https://github.com/apache/gravitino/issues/14240
### What would you like to be improved? Gravitino maps `ConnectionFailedException` to **HTTP 502 Bad Gateway**. That fits federated catalog backends that behave as a bad gateway, but it does not cover a second case: a **configured dependency is temporarily unavailable** (for example a secret provider or similar out-of-process service), where callers typically expect **HTTP 503 Service Unavailable**. There is no public exception type in `org.apache.gravitino.exceptions` that REST handlers map to 503 with a structured `ErrorResponse`. Iceberg REST (`org.apache.iceberg.exceptions.ServiceUnavailableException`) and Lance REST (`org.lance.namespace.errors.ServiceUnavailableException`) already use this status for their own APIs; the main Gravitino REST surface does not. As a result, dependency outages often surface as **HTTP 500** (via `IllegalStateException`) or are forced through **502** via `ConnectionFailedException`, which mixes two different failure modes. ### How should we improve? 1. Add `org.apache.gravitino.exceptions.ServiceUnavailableException` in `api`. 2. Add `ErrorConstants.SERVICE_UNAVAILABLE_CODE`, `ErrorResponse.serviceUnavailable(...)`, and `Utils.serviceUnavailable(message, throwable)` returning **HTTP 503** with a structured body. 3. Map `ServiceUnavailableException` in `ExceptionHandlers.BaseExceptionHandler` (so all handlers that fall through to the base path get 503). 4. Teach the Java client `ErrorHandlers` to rethrow `ServiceUnavailableException` for that error code. This change is groundwork only: it does not wire a specific secret-provider implementation. Callers (including optional/enterprise providers) can throw the new exception once this lands. -- 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]
