fix: add forwardError and fix wrapper-side error propagation#33
fix: add forwardError and fix wrapper-side error propagation#33chenjiahan wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 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".
| stream.once("error", onEvent); | ||
| stream.once("readable", onEvent); | ||
| // Empty stream | ||
| stream.once("end", onEvent); |
There was a problem hiding this comment.
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 👍 / 👎.
|
Generated by Codex and lack of review |
Summary
This PR adds the
forwardErroroption 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 forreadable/end/errorbefore resolving, updates the docs and types, and adds regression coverage while keeping the Hapi limitation explicit.Related Links