Topic: a class in Angular 4

Is available http service: this.myService.submitAmount (this. Amount).subscribe (data => {this.handleSuc (data.json ());}, err => this.handleErr (err.json ())); handleErr (err: ErrModel) {if (err.text! = undefined) alert (' This is ErrModel error '); else alert (' Some other error ');} export class ErrModel {public text: string; public errorDetails: string} It can return business an error, we tell if this. Amount> 100. And can return any other error, we tell if failure of a network or any bug. In case it is business an error fields text and errorDetails will be filled, otherwise it will be obvious  with any other fields. How it is possible to define that the error, without curve if (err.text came business! = undefined)? It Is possible-whether to make somehow so that it was possible to write simply if (err! = null)?


Re: a class in Angular 4

Hello, Stalker., you wrote: S> Is available http service: the error fact return a status-code 400-599 and the error status code - a mandatory field type sm https://tools.ietf.org/html/rfc7807 from  does not depend.