Skip to content

Answer a failed transcoded call with a JSON body - #397

Draft
zZHorizonZz wants to merge 1 commit into
eclipse-vertx:mainfrom
zZHorizonZz:transcoding-error-body
Draft

zZHorizonZz wants to merge 1 commit into
eclipse-vertx:mainfrom
zZHorizonZz:transcoding-error-body

Conversation

@zZHorizonZz

@zZHorizonZz zZHorizonZz commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #395

Motivation:

A transcoded call that fails before the response head is written returns Content-Type: application/json with an empty body. A server stream that fails after writing its head, or sends a message that can't be transcoded, never ends.

Changes:

  • Failed call before the head is written: error's HTTP status with a google.rpc.Status JSON body (code, message, details). details is empty since transcoding has no type registry to print them.
  • Failed stream after the head is written: stream ends and the status goes in the grpc-status trailer.
  • Unary message that can't be transcoded returns INTERNAL with a body.
  • Streaming message that can't be transcoded fails its write.
  • HttpGrpcOutboundStream keeps the status message.
  • Added tests for unary and streaming errors, StatusException from the handler, a stream failing after its head, and messages that can't be transcoded.

@zZHorizonZz
zZHorizonZz marked this pull request as draft November 27, 2026 12:23
@zZHorizonZz

Copy link
Copy Markdown
Member Author

Depends on #393.

Motivation:

A transcoded call that fails before the response head is written
answers Content-Type: application/json with an empty body, which is not
JSON. A server stream that fails after writing its head, or whose
message cannot be transcoded, sets the status code too late and the
call never ends.

Changes:

- GrpcTranscodingError.end answers a response with the error's HTTP
  status and google.rpc.Status as JSON: code, message and details.
  details is empty.
- Before the head is written, a failed call is answered with
  GrpcTranscodingError.end. After it, a stream ends as before and the
  status is in the grpc-status trailer.
- A unary message that cannot be transcoded answers INTERNAL with a
  body, and the call is not ended a second time.
- A streaming message that cannot be transcoded fails its write.
- HttpGrpcOutboundStream keeps the status message next to the status.
- Tests for unary and streaming errors, with and without a status
  message, for a StatusException thrown by the handler, for a stream
  that fails after its head, and for messages that cannot be
  transcoded.
@zZHorizonZz
zZHorizonZz force-pushed the transcoding-error-body branch from e0f8186 to efeb276 Compare December 1, 2026 09:16
@vietj vietj added this to the 5.3.0 milestone Dec 4, 2026
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.

A failed transcoded call answers application/json with an empty body

2 participants