class
final
A response that represents an error or failure, either from a non-successful HTTP status, an error while executing the request, or some other failure which occurred during the parsing of the response.
class HttpErrorResponse extends HttpResponseBase implements Error { constructor(init: { error?: any; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }) name: 'HttpErrorResponse' message: string error: any | null override ok: false // inherited from common/http/HttpResponseBase constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, defaultStatus: number = HttpStatusCode.Ok, defaultStatusText: string = 'OK') headers: HttpHeaders status: number statusText: string url: string | null ok: boolean type: HttpEventType.Response | HttpEventType.ResponseHeader }
Any error returned on the Observable
response stream will be wrapped in an HttpErrorResponse
to provide additional context about the state of the HTTP layer when the error occurred. The error property will contain either a wrapped Error object or the error response returned from the server.
|
init | object |
Property | Description |
---|---|
name: 'HttpErrorResponse' | Read-Only |
message: string | Read-Only |
error: any | null | Read-Only |
override | Errors are never okay, even when the status code is in the 2xx success range. |
ok: false | Read-Only |
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/common/http/HttpErrorResponse