私のAngular 2アプリケーションのエラー処理に問題があります。バックエンドサーバがオフラインのとき が、私はコンソールでこのキャッチされないエラーを取得しています:角度2:キャッチされていない504エラー(ゲートウェイタイムアウト)
http://localhost:4200/api/public/index.php/data 504(ゲートウェイタイムアウト)をGET
マイhttp.getサービスでは、このようになります:
getData(): Observable<any> {
let apiUrl = `${API_URL}data`;
this.http.get(apiUrl)
.map((res => res.json() || []))
.subscribe(response => {
let data = [];
let index = 0;
if (typeof(response.data) !== 'undefined' && response.success !== false) {
// add index to each entry
response.data.forEach(entry => {
data.push({
id: index++,
title: entry.title,
others: entry.others
});
});
this.dataCollection = data;
this.subject.next(data);
}
}, error => {
this.subject.error("The Server could not be reached. Please wait until a connection can be established, or reload the page.");
});
return this.subject.asObservable();
}
Angular 2がこのエラーをコンソールに送信しないようにするにはどうすればよいですか?
私はあなたができるとは思わない。アプリケーションがエラーなく処理しても、ブラウザーは要求が失敗したことを知っています。 – jonrsharpe