我正在创建一个观察者,并且在某个时候我抛出了一个Observer.error('some error')错误
但是在订阅中,错误未定义。有人知道会发生什么吗?
代码下方:
private getUserDataAndroid(): Observable<any> {
return Observable.create(observer => {
this.androidPermissions.requestPermissions([
this.androidPermissions.PERMISSION.ACCESS_FINE_LOCATION
]).then(result => {
if (!result.hasPermission) {
observer.error('some error');
...
this.getUserDataAndroid().subscribe(user => {
this.loading.dismiss();
this.storageProvider.salvarUsuario(user);
this.navCtrl.setRoot(PaginaInicialPage);
}, error => {
console.log(error); // HERE THE ERROR IS UNDEFINED
this.showMessageLoginError();
});