ninest / dpsms

Distributed physical storage management system
1 stars 0 forks source link

Create error pages #23

Open acd124 opened 1 year ago

acd124 commented 1 year ago

If any api calls result in errors or errors happen in the client we would rather this be handled nicely and show the user a page about it instead of the app crashing. Same goes for 404 pages probably

ninest commented 1 year ago

https://nextjs.org/docs/pages/building-your-application/routing/custom-error

Add error pages to all routes. These error pages should be at the same level as page.tsx.

They should show a helpful error message when a function that fetches data fails or if a server action fails.

if something is not found, It should be a 404 page with a button to redirect the user back to the home route. See the linked docs for notFound() and 404 pages

it may help if you make an ErrorBlock component or something similar so you do not have to copy the same styles everywhere.

to test that error page works, you can add something like throw new Error(“message”) in a server component