How to Convert HTTP Status Codes to statusText in Javascript
Have you ever had a 3rd-party API that sends empty response.statusText messages? Not knowing what codes mean when they happen can be frustrating for users when they are given a status code with no description of what it means.
While many situations often call for a custom domain-specific error message, it can still be helpful to use the HTTP code’s statusText as a fallback. That way the user is never presented with something like “HTTP error code 500” without knowing an Internal Server Error occured.