Skip to content

Mention ErrorBoundary for error handling #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions src/routes/guides/fetching-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ The `Switch/Match` construct provides one way to manage these conditions.
When the fetch succeeds and user data is retrieved, the `user()` condition becomes active, and its related block executes.
However, if there's an error while fetching, the `user.error` block becomes `true`, leading to its corresponding `Match` block being shown.

:::tip

If you anticipate errors, you may want to wrap `createResource` in an [ErrorBoundary](/reference/components/error-boundary).

:::

In addition to the `error` property, the `loading` property offers a way to display a loading state to the user during the fetch operation.


Expand Down
Loading