feat(devframe): forward onFunctionError/onGeneralError to startHttpAndWs#84
Open
antfubot wants to merge 4 commits into
Open
feat(devframe): forward onFunctionError/onGeneralError to startHttpAndWs#84antfubot wants to merge 4 commits into
antfubot wants to merge 4 commits into
Conversation
Hosts that delegate their RPC/WS server to startHttpAndWs and own their own structured error diagnostics (e.g. a coded error reporter) had no way to observe RPC failures — the internal createRpcServer call had no passthrough for birpc's onFunctionError/onGeneralError, so those errors were silently absorbed instead of surfacing through the host's own diagnostics.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A host that delegates its RPC/WS server to
startHttpAndWsand owns its own structured error diagnostics (a coded error reporter, e.g.@vitejs/devtools'sDTK0011/DTK0012) had no way to observe RPC failures.startHttpAndWs's internalcreateRpcServercall installs its ownresolveron birpc'srpcOptionsbut had no passthrough for birpc'sonFunctionError/onGeneralError— a thrown handler error or a message deserialize/serialize failure was silently absorbed instead of surfacing through the host's own diagnostics.This is the one gap identified while evaluating a full
createWsServer→startHttpAndWsdelegation for a downstream consumer: without this, adoptingstartHttpAndWswholesale would drop that host's structured error reporting.What
Adds
rpcOptions?: Pick<EventOptions<...>, 'onFunctionError' | 'onGeneralError'>toStartHttpAndWsOptions, forwarded verbatim into the internalcreateRpcServer's birpc options alongside the existingresolver. Matches birpc's own callback contract exactly (including theboolean | voidreturn that lets a caller suppress birpc's default error response), so it's a true passthrough rather than a narrowed shim.Testing
Added
packages/devframe/src/node/__tests__/server.test.ts:rpcOptions.onFunctionErrorwith the right name/error, and the caller still gets its rejection (nothing is swallowed)rpcOptions.onGeneralErrorpnpm lint && pnpm test && pnpm typecheck && pnpm buildall pass.This PR was created with the help of an agent.