oguzhanunlu commented on PR #14965: URL: https://github.com/apache/iceberg/pull/14965#issuecomment-3754675981
Thanks for the feedback @danielcweeks. You're right that a 404 on /v1/config could come from either: 1. A valid Iceberg server (warehouse doesn't exist) 2. A misconfigured URL pointing to a non-Iceberg server I traced through the error handling flow and have two options: **Option 1: Check error.type() != null** When DefaultErrorHandler.parseResponse() fails to parse the response body, it returns an ErrorResponse with type = null. Per [the spec](https://github.com/apache/iceberg/blob/c1aed477d1c0c8ef93aa8dea23f75e5ab11f5be6/open-api/rest-catalog-open-api.yaml#L1988), type is required, so valid Iceberg servers must include it. ```java if (error.code() == 404 && error.type() != null) { throw new NoSuchWarehouseException("%s", error.message()); } ``` Pros: Minimal change Cons: Uses type as a proxy for "did parsing succeed?" - relies on the fallback not setting type, which is an implementation detail rather than intentional design **Option 2: Add explicit `hasValidBody` flag to ErrorResponse** Add a boolean field that explicitly tracks whether the response body was successfully parsed. Pros: Explicit, self-documenting, won't break if fallback logic changes Cons: Larger change - requires modifying ErrorResponse, parser, and fallback logic Which approach would you prefer? -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
