-
Notifications
You must be signed in to change notification settings - Fork 175
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
Node process exits with unhandled exception
Expected behavior 🤔
Load function should ignore errors and ErrorBoundary should get triggered.
Steps to reproduce 🕹
Steps:
import { Show, ErrorBoundary } from "solid-js";
import { type RouteDefinition, type RouteSectionProps, cache, createAsync } from "@solidjs/router";
import { HttpStatusCode } from "@solidjs/start";
export const route = {
load: ({ params }) => getHouse(params.house)
} satisfies RouteDefinition;
const getHouse = cache(async (house: string) => {
"use server"
if (house != "gryffindor") {
throw new Error("House not found");
}
return house;
}, "house");
export default function House(props: RouteSectionProps) {
const house = createAsync(() => getHouse(props.params.house), {
deferStream: true,
});
return (
<ErrorBoundary
fallback={(e) => (
<Show when={e.message === "House not found"}>
<HttpStatusCode code={404} />
<h1>House not found</h1>
</Show>
)}
>
<div>{house()}</div>
</ErrorBoundary>
);
}- Run
http://localhost:3000/house/gryffindorand make sure that page works - Run
http://localhost:3000/house/notgryffindorand see that node process fail with unhandlet exception
Context 🔦
It should be possible to handle errors in combination with preloading data.
Your environment 🌎
System:
OS: Windows
Node: v21.1.0
Packages:
vinxi: 0.3.11
solid-js: 1.8.16
@solidjs/router: 0.13.1
@solidjs/start: 1.0.0-rc.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working