Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/start/src/fns/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ export async function handleServerFunction(h3Event: H3Event) {
h3Event.res.headers.set("content-type", "text/plain");
return serializeToJSONStream(result);
} catch (x) {
// Give monitoring a chance to observe server-function failures before
// they are serialized into the response, since no error hook fires for
// them today. Thrown Responses are control flow (redirects, forbidden),
// not errors.
if (!(x instanceof Response)) (globalThis as any).__reportServerFnError?.(x);
if (x instanceof Response) {
if (singleFlight && instance) {
x = await handleSingleFlight(event, x);
Expand Down
Loading