Errors handling is part of our work as developers. You can try to ignore them at first, but to offer a good user experience, you don't want your website breaking just because one of the API endpoints decided to give up on you. These days we try to find clever workarounds to run our applications with a graceful degradation strategy. We build software to work in an optimal environment while providing certain fallbacks not to break the experience entirely when there's some disturbance in the system (e.g., lousy network condition, CPU lag, etc.).
This post is a short, hands-on walkthrough: one demo app, one simulated 500, and the fix that gets the UI out of a stuck loading state. For the full list of failures worth testing (401, 422, 429, network errors, timeouts, malformed JSON) with a rule for each, read How to Test Error States in Your Frontend App.