HttpErrorResponse
class
npm Package | @angular/common |
---|---|
Module | import { HttpErrorResponse } from '@angular/common/http'; |
Source | common/http/src/response.ts |
Overview
class HttpErrorResponse extends HttpResponseBase implements Error { constructor(init: {...}) get name: 'HttpErrorResponse' get message: string get error: any | null get ok: false // inherited from common/http/HttpResponseBase get headers: HttpHeaders get status: number get statusText: string get url: string | null get ok: boolean get type: HttpEventType.Response | HttpEventType.ResponseHeader }
Description
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.
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.
Constructor
constructor(init: {
error?: any;
headers?: HttpHeaders;
status?: number;
statusText?: string;
url?: string;
})
Members
get name: 'HttpErrorResponse'
get message: string
get error: any | null
get ok: false
Errors are never okay, even when the status code is in the 2xx success range.
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/common/http/HttpErrorResponse