Skip to content

Update the serverFunctions.onError reference - #1610

Open
adipascu wants to merge 4 commits into
solidjs:mainfrom
adipascu:docs/server-fn-on-error-contract
Open

Update the serverFunctions.onError reference#1610
adipascu wants to merge 4 commits into
solidjs:mainfrom
adipascu:docs/server-fn-on-error-contract

Conversation

@adipascu

@adipascu adipascu commented Jul 29, 2026

Copy link
Copy Markdown
  • I have read the Contribution guide
  • This PR references an issue (except for typos, broken links, or other minor problems)

Description(required)

Updates the serverFunctions.onError section added in #1609 with the rest of the contract. I wrote the option itself (solidjs/solid-start#2262), so these are the parts worth spelling out for anyone writing a handler:

  • a thrown redirect reaches the export as a Response, so a handler that replaces everything it sees turns redirects into errors
  • the return value is not awaited, so the export cannot be async
  • only calls arriving over the network reach it, not a server function called during rendering, nor an API route

The example now guards thrown instanceof Response first, so it keeps working for anyone who adapts it, and reports through a monitoring SDK rather than console.error, which shows what the server-only bundling is for.

Checked against a running app: the same server function called over the network, during rendering, and in process from an API route, with only the network call reaching the handler.

Paired with solidjs/solid-start#2266, the same additions to the JSDoc for this option.

Related issues & labels

  • Suggested label(s): documentation

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for solid-docs ready!

Name Link
🔨 Latest commit 3810a7e
🔍 Latest deploy log https://app.netlify.com/projects/solid-docs/deploys/6a6b0843bf76b3000825bc89
😎 Deploy Preview https://deploy-preview-1610--solid-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@adipascu
adipascu force-pushed the docs/server-fn-on-error-contract branch from 6162e98 to 77efc9b Compare July 29, 2026 15:33
@adipascu adipascu changed the title Document the full serverFunctions.onError contract Correct and expand the serverFunctions.onError reference Jul 29, 2026
@adipascu
adipascu force-pushed the docs/server-fn-on-error-contract branch from 77efc9b to 251018e Compare July 29, 2026 15:34
@adipascu adipascu changed the title Correct and expand the serverFunctions.onError reference Expand the serverFunctions.onError reference Jul 29, 2026
@adipascu
adipascu force-pushed the docs/server-fn-on-error-contract branch from 251018e to c7635c5 Compare July 29, 2026 15:39
@adipascu adipascu changed the title Expand the serverFunctions.onError reference Update the serverFunctions.onError reference Jul 29, 2026
@adipascu
adipascu force-pushed the docs/server-fn-on-error-contract branch 10 times, most recently from 34879bd to 7bd631e Compare July 29, 2026 15:54
@adipascu
adipascu marked this pull request as ready for review July 29, 2026 15:54
@adipascu

Copy link
Copy Markdown
Author

Happy to trim if this reads too verbose for a reference entry.

@adipascu
adipascu force-pushed the docs/server-fn-on-error-contract branch 2 times, most recently from 1141eae to 151e04d Compare July 29, 2026 16:01
@adipascu
adipascu force-pushed the docs/server-fn-on-error-contract branch from 151e04d to 2c023a3 Compare July 29, 2026 16:02
@LadyBluenotes
LadyBluenotes enabled auto-merge (squash) July 29, 2026 18:55
auto-merge was automatically disabled July 30, 2026 00:51

Head branch was pushed to by a user without write access

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.

2 participants