Akash3121 opened a new issue, #9983: URL: https://github.com/apache/paimon/issues/9983
### Search before asking - [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar. ### Paimon version master (1d368b4a5932f8221fd28e2555001abdb8fb12ee) ### Compute Engine PyPaimon REST client. Engine-independent. ### Minimal reproduce step ```python from pypaimon.api.client import _parse_error_response, DefaultErrorHandler error = _parse_error_response( '{"message":"missing",' '"resourceType":"TABLE",' '"resourceName":"db.t"}', 404, ) print(error.code) DefaultErrorHandler.get_instance().accept(error, "unknown") ``` Observed behavior: error.code is None A generic RESTException is raised instead of NoSuchResourceException. _parse_error_response uses the HTTP status only when parsing fails or when the parsed response has no message. If valid JSON contains a message but omits the optional code , the parsed object is returned unchanged. Relevant code: - paimon-python/pypaimon/api/client.py : _parse_error_response - paimon-python/pypaimon/api/client.py : DefaultErrorHandler.accept The JVM REST client already falls back to the HTTP status when the parsed error code is null. ### What doesn't meet your expectations? The HTTP status should be used when a valid error response does not contain an application-level code. A 404 response should map to NoSuchResourceException, a 409 response to AlreadyExistsException, and a 503 response to ServiceUnavailableException. Returning a generic RESTException can also break catalog operations that rely on typed exceptions for ignore-if-exists or ignore-if-not-exists behavior. ### Anything else? A possible fix is to normalize every successfully parsed response: ```python if error.code is None: error.code = status_code ``` The check should use `is None`, rather than truthiness. Suggested tests: 1. Valid error JSON without code for HTTP 404 2. Valid error JSON without code for HTTP 409 3. Valid error JSON without code for HTTP 503 4. End-to-end `_execute_request` tests asserting the typed exceptions 5. Catalog-level ignore-if-missing and ignore-if-existing behavior ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- 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]
