My Api is giving me different types of status codes for warnings and errors. I have to show different alerts based on response.
I am calling http service like this:
service.ts
@Injectable()
export class TestService {
    getData () {
        return this.http.get('publi/api/list')
            .map((response: Response) => response.json())
            .catch(this.handleError);
    }
    public handleError(error: any): Observable<any> {
        console.log(error, 'error!!!!!!');
        return Observable.throw(error.json() || 'server error');
    }
}
component.ts
export class TestComponent implements OnInit {
    constructor(private testService: TestService) { }
    ngOnInit() {
        this.getAllList();
    }
    getAllList() {
        this.testService.getData()
            .subscribe(res => this.sucessList(res),
            err => this.errList(err))
    }
    sucessList(res) {
        console.log(res, 'sucessApprovalsPermissions');
    }
    // Here I need varions
    errList(err) {
        console.log(err, 'err');
        this.errApprovalPermissions = err.message.message;
    }
}