{ "id": "api/common/http/HttpErrorResponse", "title": "HttpErrorResponse", "contents": "\n\n
\n
\n
\n \n API > @angular/common > @angular/common/http\n
\n \n
\n \n
\n

HttpErrorResponselink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

A response that represents an error or failure, either from a\nnon-successful HTTP status, an error while executing the request,\nor some other failure which occurred during the parsing of the response.

\n\n

See more...

\n
\n \n \n \n
\n\nclass HttpErrorResponse extends HttpResponseBase implements Error {\n constructor(init: { error?: any; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; })\n name: 'HttpErrorResponse'\n message: string\n error: any | null\n ok: false\n\n // inherited from common/http/HttpResponseBase\n constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, defaultStatus: number = HttpStatusCode.Ok, defaultStatusText: string = 'OK')\n headers: HttpHeaders\n status: number\n statusText: string\n url: string | null\n ok: boolean\n type: HttpEventType.Response | HttpEventType.ResponseHeader\n}\n\n\n \n \n\n
\n\n\n \n\n \n \n
\n

Descriptionlink

\n

Any error returned on the Observable response stream will be\nwrapped in an HttpErrorResponse to provide additional context about\nthe state of the HTTP layer when the error occurred. The error property\nwill contain either a wrapped Error object or the error response returned\nfrom the server.

\n\n \n
\n\n \n\n\n\n\n\n\n

Constructorlink

\n\n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n \n\n constructor(init: { error?: any; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; })\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n
\n \n init\n object\n \n \n
\n\n \n\n\n \n\n \n
\n
\n\n\n\n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n name: 'HttpErrorResponse'\n Read-Only\n \n \n \n
\n \n message: string\n Read-Only\n \n \n \n
\n \n error: any | null\n Read-Only\n \n \n \n
\n \n ok: false\n Read-Only\n \n

Errors are never okay, even when the status code is in the 2xx success range.

\n\n \n
\n
\n\n\n\n\n\n \n\n\n
\n
\n\n\n" }