Skip to content

fix(fullstack): preserve untyped server function error status codes#5663

Open
constantin-jais wants to merge 1 commit into
DioxusLabs:mainfrom
constantin-jais:fix/server-fn-untyped-error-status
Open

fix(fullstack): preserve untyped server function error status codes#5663
constantin-jais wants to merge 1 commit into
DioxusLabs:mainfrom
constantin-jais:fix/server-fn-untyped-error-status

Conversation

@constantin-jais

Copy link
Copy Markdown

Summary

  • preserve the HTTP status already computed in ErrorPayload for anyhow::Error and CapturedError untyped server function responses
  • add regression tests for HttpError, ServerFnError, and shared CapturedError paths

Validation

  • cargo test -p dioxus-fullstack --features server untyped_error_status_tests -- --nocapture

The MakeAxumError impls for anyhow::Error and shared CapturedError build
an ErrorPayload with the right status (downcasting ServerFnError and
HttpError) but then hardcode the HTTP response status to 500. The RPC
payload told clients 400/401 while the wire status said 500 — and
examples/07-fullstack/handling_errors.rs documents
HttpError::bad_request(...)? as producing an HTTP 400.

Set the response status from the already-computed payload code, exactly
like the typed Result<T, HttpError> and Result<T, StatusCode> paths do.

Adds regression tests for the three untyped paths (anyhow + HttpError,
anyhow + ServerFnError, shared CapturedError + HttpError).

Claude-Session: https://claude.ai/code/session_015toc12d2m9EyacRBuFQuuZ
@constantin-jais constantin-jais requested a review from a team as a code owner July 3, 2026 08:17
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