Skip to content

Commit

Permalink
Clarify documentation on how to handle 404s
Browse files Browse the repository at this point in the history
When discussing this topic with colleagues the wording 'you don't have to do anything' was interpreted in an ambiguous way.

This re-phrasing linkis back to splat routes as a good option for handling 404s
  • Loading branch information
runmoore committed Jul 19, 2022
1 parent db0619d commit fc301b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/guides/not-found.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ There are two primary cases where a Remix site should send a 404:
- The URL doesn't match any routes in the app
- Your loader didn't find any data

The first case is already handled by Remix, you don't have to do anything. It knows your routes so it knows if nothing matched. The second case is up to you, but it's really easy.
The first case is already handled by Remix, you don't have to throw an error yourself. It knows your routes so it knows if nothing matched (_consider using a [Splat Route][splat-route] to handle this case_). The second case is up to you, but it's really easy.

## How to Send a 404

Expand Down Expand Up @@ -117,3 +117,4 @@ As you can probably tell, this mechanism isn't just limited to 404s. You can thr
[catch-boundary]: ../api/conventions#catchboundary
[errors]: errors
[404-status-code]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
[splat-route]: ./routing#splats

0 comments on commit fc301b4

Please sign in to comment.