Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Dealing with unexpected errors

During runtime, a Remix application is executed both in the browser and on the server. A lot can go wrong, and unexpected errors can happen both on the client and server. It is important to consider the error case to provide a resilient user experience. In this section, we will investigate how to handle unexpected errors in Remix both at the root level and in nested routes.

Invoking client and server errors

In Chapter 2, Creating a New Remix App, we provided a troubleshooting guide and investigated how Remix handles errors on both the client and server uniformly. Let’s review Remix’s default error handling again by invoking some “unexpected” errors:

  1. Open your BeeRich application in an editor.
  2. Open the dashboard.tsx route module inside the app/routes folder.
  3. Add the following code inside the loader function body before the return statement:
    throw Error('Something went wrong!');

    By throwing an error...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf