HttpClient distinguishes errors based on status codes: 4xx indicates client errors, such as unauthorized access, while 5xx indicates server errors, like server overload. For example, a 404 status code means the resource was not found, and a 500 status code indicates a server issue.
Additional Notes
How does the HttpClient distinguish between client and server errors?