7

Error Handling in Remix

Error handling is an important part of building resilient user experiences. We can distinguish two kinds of errors:

  • Unexpected errors, such as network timeouts
  • Expected failures (exceptions) thrown on purpose

Remix provides primitives and conventions to handle both unexpected and expected errors uniformly. This chapter covers the following topics:

  • Dealing with unexpected errors
  • Handling thrown responses
  • Handling page-not-found (404) errors

First, we will fabricate some unexpected errors and learn how to handle them. Next, we will review the difference between returning and throwing Response objects in loader and action functions. We will see how we can handle thrown responses with Remix’s ErrorBoundary. Finally, ...

Get Full Stack Web Development with Remix now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.