OpenBeta / open-tacos

Rock climbing route catalog (openbeta.io)
https://openbeta.io
GNU Affero General Public License v3.0
110 stars 111 forks source link

Handle areas that don't exist #1100

Closed heliodor closed 3 months ago

heliodor commented 4 months ago

After an area was deleted, I now see this server error instead of a 404 Not Found page:

https://openbeta.io/area/f92d68ca-1b6f-5bc7-8d1f-16b3961b3cce/puerto-rico

Screenshot 2024-02-20 at 1 07 40 PM

heliodor commented 4 months ago

Any url that has a UUID that does not exist in the database leads to the above error. Any url that has other data instead of a UUID leads to a 404 page.

Try: https://openbeta.io/area/f92d68ca-1b6f-5bc7-8d1f-16b3961b3cce/puerto-rico https://openbeta.io/area/f92d68ca-1b6f-5bc7-8d1f-16b3961b3cce https://openbeta.io/area/f92d68ca-1b6f-5bc7-8d1f-16b3961b3ccf https://openbeta.io/area/f92d68ca-1b6f-5bc7-8d1f-16b3961b3ccd https://openbeta.io/area/asdfasdf

melissapthai commented 3 months ago

Happy to take this on if no one else is. So just to confirm, if it's not a valid area, the page should return 404?

vnugent commented 3 months ago

Happy to take this on if no one else is. So just to confirm, if it's not a valid area, the page should return 404?

Correct. You can read more about Next 13 error handling https://nextjs.org/docs/app/api-reference/file-conventions/not-found

melissapthai commented 3 months ago

@vnugent thanks for approving my PR. I think this issue can be closed now, but lmk if there's anything I missed!

vnugent commented 3 months ago

@melissapthai thanks for the PR @heliodor thanks for reporting the issue

I have a small followup PR that customizes the 404 page. We can close this one.