PatientOtter
PatientOtter
SSolidJS
Created by PatientOtter on 11/5/2024 in #support
Matching Error State with createAsync
When using createResource one has access to resource.error to handle the case when we get an error from our remote calls.
<Switch>
<Match when={user.error}>
<span>Error: {user.error}</span>
</Match>
<Match when={user()}>
<div>{JSON.stringify(user())}</div>
</Match>
</Switch>
<Switch>
<Match when={user.error}>
<span>Error: {user.error}</span>
</Match>
<Match when={user()}>
<div>{JSON.stringify(user())}</div>
</Match>
</Switch>
How would I go about doing something similar when using createAsync and query? If it's in a preload function of the router and fails is the only recourse to have the entire page fall back to an ErrorBoundry?
2 replies