Skip to content

[api] Fall back to the HTTP status when the error body omits code - #9661

Open
jackylee-ch wants to merge 1 commit into
apache:masterfrom
jackylee-ch:rest-error-code-nullable
Open

[api] Fall back to the HTTP status when the error body omits code#9661
jackylee-ch wants to merge 1 commit into
apache:masterfrom
jackylee-ch:rest-error-code-nullable

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

Purpose

ErrorResponse's field and getter are Integer, but the @JsonCreator parameter was primitive int and the shared mapper leaves FAIL_ON_NULL_FOR_PRIMITIVES off. code has no required: entry in rest-catalog-open-api.yaml, so a server may legally omit it; it then deserialized to 0, the HTTP-status fallback in HttpClient#buildErrorResponse never fired, and a 404 surfaced as RESTException reading (HTTP 0) instead of NoSuchResourceException. DefaultErrorHandler tolerates a null code too.

Public constructor signature change in paimon-api: source- but not binary-compatible.

Tests

HttpClientTest.

Written with Claude Code; reasoning and verification are mine.

@jackylee-ch
jackylee-ch force-pushed the rest-error-code-nullable branch from 18d36bf to e0dc764 Compare September 7, 2026 01:52
The creator parameter for "code" was primitive, so Jackson filled 0 for an
absent value and getCode() was never null. That made the HTTP-status
fallback in HttpClient unreachable and turned a 404 without a body code
into a generic RESTException reading "(HTTP 0)".
@jackylee-ch
jackylee-ch force-pushed the rest-error-code-nullable branch from e0dc764 to 24a1767 Compare September 7, 2026 11:14
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.

1 participant