Skip to content

fix: add forwardError and fix wrapper-side error propagation#33

Closed
chenjiahan wants to merge 2 commits intomainfrom
codex/fix-forward-error-propagation
Closed

fix: add forwardError and fix wrapper-side error propagation#33
chenjiahan wants to merge 2 commits intomainfrom
codex/fix-forward-error-propagation

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Mar 31, 2026

Summary

This PR adds the forwardError option to the runtime middleware behavior and fixes wrapper-side error propagation so application-level error handlers can receive handled errors consistently. It also makes Koa/Hono stream handoff wait for readable/end/error before resolving, updates the docs and types, and adds regression coverage while keeping the Hapi limitation explicit.

Related Links

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a95f623b3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/index.js
Comment on lines +226 to +229
stream.once("error", onEvent);
stream.once("readable", onEvent);
// Empty stream
stream.once("end", onEvent);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve stream wait on close events

waitUntilStreamReady only subscribes to error, readable, and end, so a stream that is destroyed before producing data can leave the wrapper promise pending forever. This is reachable in Koa/Hono when the client disconnects early: on-finished cleanup destroys the file stream, which emits close without guaranteeing readable/end, and the request middleware never resolves/rejects. Please also handle close (or an already-destroyed stream) so aborted stream responses do not hang request processing.

Useful? React with 👍 / 👎.

@chenjiahan chenjiahan closed this Mar 31, 2026
@chenjiahan
Copy link
Copy Markdown
Member Author

Generated by Codex and lack of review

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