我有一个Angular 4应用程序,使用jsonp
来处理api请求。每个api调用看起来都很相似,并具有以下基本结构:
requestInteractions() {
let apiPath = `xyz`;
this.setParams(); //
return this
.jsonp.request(this.fullRequestUrl(apiPath), { search: this.params })
.map(res => res.json())
.subscribe(
data => this.ngRedux.dispatch(this.actions.initializeStateFromInteractions(data)),
err => this.handleError(err),
);
}
某些请求不处理数据,因此subscribe
块看起来像:
.subscribe(
data => {},
err => this.handleError(err),
);
JS错误被记录到服务器,我每天多次收到错误Uncaught (in promise): Response with status: 200 Ok for URL: null
。它永远不会发生在localhost上,而且在检查生产时,我无法重现错误。整体而言,该应用程序是稳定的,每天处理数千个电话。
提前感谢您的想法。