typescript - Property 'status' does not exist on type 'Error' -
i'm using angular 2 , passing error http request logandpasson method. getting error "property 'status' not exist on type 'error'." typeof error object seems typeof error recognized typeof file is.
private logandpasson (error: error) { if (error.status == 403) { things } return observable.throw(error); } i got around setting error's type 'any' seems there should better way. there library import typeof error? there way handle besides writing own error class , importing it?
the object passed http error callback of type response @angular/http module. same response initial http call. if there error response, response sent error through subscriber.
import { response } '@angular/json'; http.get(..) .subscribe( (res: response) => { dosomething(res.json()) } (res: response) => { ... }); so basically, trying use error not correct. works when use any, during runtime actual response object passed, does have status property.
Comments
Post a Comment