Best practice way to handle and redirect 50X and 404 errors when querying sanity fetch
See original GitHub issueHey 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
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Best practice way to handle and redirect 50X and 404 errors when ...
Hey Nuxt Sanity team! I am looking for advice on error handling: When I query a page entry using the slug, I will...
Read more >Best Practices for Managing 404 Error Pages - Todhost Blog
If you have valuable links pointing to 404 pages, use a 301 redirect to correct and possibly contact the website owner for proper...
Read more >fix(nuxt): pass async-data errors through to client by ... - GitHub
There will still be some differences between client + server errors because ... Best practice way to handle and redirect 50X and 404...
Read more >404 When Hosting Sanity on Netlify
This might be a noob question, but we are struggling with 404 when hosting Sanity on Netlify. When visiting the site it will...
Read more >Best Practices for Handling 404 Errors in Respect to SEO
Don't panic when your site has 404 errors · Review all the 404 links on Google and Bing Webmaster Tools · Add 301...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can follow https://github.com/nuxt/framework/pull/8521 - when this is merged, you can…
That worked @danielroe thank you. One last question though – the error doesn’t provide an error status code – it’s just a boolean. How do determine the status code? It would be good to display a different error message based on whether it’s a network error as opposed to a server error?