fix: await server function error handlers - #2269
Conversation
🦋 Changeset detectedLatest commit: b608338 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
|
Ran my production handler under the awaited contract, every path behaves the same and sync handlers are unaffected. Drop-in for me, thanks. One edge worth a guard: the call sits inside try {
const replacement = await onServerFunctionError?.(thrown);
return replacement ?? thrown;
} catch {
return thrown;
}A spec for a rejecting handler and one for an async handler resolving to a |
|
@adipascu , good ideas, added the spec, and the reutrn of the original error. |
Await
serverFunctions.onErrorhandlers before serializing errors. Async handlers resolving toundefinedpreserve the original error.Includes regression tests and updated documentation.
asyncserverFunctions.onErrorhandler is not awaited #2268cc @adipascu