SolidJSS
SolidJSโ€ข15mo agoโ€ข
1 reply
PatientOtter

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>


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?
Was this page helpful?