-
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 😯
I have created a basic reproducible version of using an ErrorBoundary to handle errors thrown inside of a FileRouter load function. An example of this is provided in the HttpStatusCode Page, where an Error boundary is used for handling an error thrown in a cached function.
I have produced a similar example below with a newly scaffolded version 0.5.1 solid-start app. Navigating to this page produces an uncaught error and crashes the development server.
// @refresh reload
import {
createAsync,
RouteDefinition,
cache,
} from '@solidjs/router';
import { ErrorBoundary } from 'solid-js/web';
const getData = cache(async () => {
const shouldThrow = true;
const data = 'Bill';
if (shouldThrow) {
throw new Error('ya failed');
}
return data;
}, 'some-data');
export const route = {
load: async () => {
getData();
},
} satisfies RouteDefinition;
const Home = () => {
const data = createAsync(getData);
return (
<ErrorBoundary fallback={<div>Ya failed</div>}>
<h1>Ya name: {data()}</h1>
</ErrorBoundary>
);
};
export default Home;Expected behavior 🤔
The ErrorBoundary fallback property should be displayed.
Steps to reproduce 🕹
Steps:
- Clone the repository: https://github.com/JacobSNGoodwin/solid-error-boundary.git
- Install dependencies (I used both
pnpmandbun - Run
bun devor equivalent - Open
localhost:3000 - Observe the dev server's unhandled exception, and nothing displayed in the browser.
Context 🔦
I am trying to handle errors in general. I was recently working on an authorization callback and handler and was facing issues with the dev server crashing when cached functions (or functions which they called) threw errors.
Your environment 🌎
System:
OS: macOS 14.2.1
Arch: Apple M1 Pro
Binaries:
Node: v18.16.1
pnpm: 8.6.6
bun: 1.0.26
npmPackages:
"@solidjs/router": "^0.11.3",
"@solidjs/start": "^0.5.1",
"solid-js": "^1.8.14",
"vinxi": "^0.2.1"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working