NG.VII · Angular 22 practice question
An HttpClient request times out before the server responds. What value does the status property have on the resulting HttpErrorResponse?
Check answer and explanation
Correct answer: 0
Explanation
Both network errors and client-side timeout errors produce an HttpErrorResponse with a status code of 0.
Common trap
408 is an HTTP status code returned by a server, whereas client-side timeouts never receive a server status and therefore report 0. -1 is a common sentinel value in some libraries, but Angular's HttpErrorResponse uses 0 for network and timeout failures.
Source: Angular docs: Making HTTP requests — Handling request failure
Checked against the cited text on 2026-11-25.