Skip to content

fix(ext/http): route invalid async responses to onError - #36437

Open
subotac wants to merge 1 commit into
denoland:mainfrom
subotac:fix/serve-invalid-return-onerror
Open

fix(ext/http): route invalid async responses to onError#36437
subotac wants to merge 1 commit into
denoland:mainfrom
subotac:fix/serve-invalid-return-onerror

Conversation

@subotac

@subotac subotac commented Aug 5, 2026

Copy link
Copy Markdown

Fixes #36425.

Invalid values returned asynchronously from Deno.serve handlers were validated inside a promise fulfillment callback, after the rejection handler had already been attached to the original handler promise. The
resulting TypeError therefore bypassed onError.

Attach error handling after response conversion and fall back to the internal 500 response if an asynchronous onError result also fails. Extend the existing serve callback test to cover both synchronous and
asynchronously resolved invalid values.

Tests:

  • cargo test -p unit_tests --test unit -- handleServeCallbackReturn
  • cargo test -p unit_tests --test unit -- serve
  • formatting and targeted JS/TS lint checks

@deno-cla-assistant

Copy link
Copy Markdown

Deno Individual Contributor License Agreement

The following contributors need to sign the CLA before this PR can be merged:

Click here to review and sign the CLA | Re-run CLA check


This is an automated message from CLA Assistant

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.

Deno.serve's onError handler is not called when the return type is wrong, since 2.8.3

1 participant