sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Best practice way to handle and redirect 50X and 404 errors when querying sanity fetch

Open toddpadwick opened this issue 3 years ago • 0 comments

Hey Nuxt Sanity team! I am looking for advice on error handling: When I query a page entry using the slug, I will need a way to do the following:

  • Redirect to the nuxt 404 error page if the query returns empty
  • Redirect and render the appropriate error when the query returns a 50X error

I am new to this module and I am not sure how best to do this. Can anyone share their method for doing so?

I am using Nuxt 3.0.0-rc.11 and Nuxt/sanity ^1.3.0

toddpadwick avatar Oct 12 '22 13:10 toddpadwick