error-handling - 检查推送是否成功-angularfire2

标签 error-handling ionic2 angularfire2

目前,我正在开发与Firebase数据库通信的Ionic2应用程序。在更新节点时,有时它起作用,有时却不起作用。
所以我厌倦了使用以下代码来处理错误:

this.db.list("/Events/" + this.eventID+ "/teilnehmer").push(this.userID)
        .then(resolve => {
          console.log('success');
        }, reject => {
          console.log('error');
        })
        .catch(reject => {
          console.log('catch');
        });

但是,即使我断开了互联网连接,也不会引发任何错误。
你们当中有人知道如果推送不成功怎么办?

最佳答案

我也遇到过这样的情况,即推送有时无法返回 promise ,因此我在github FirebaseListObservable push() takes too long to add上提出了问题,但不幸的是没有解决,我通过电子邮件联系了Firebase支持,支持团队检查了我的问题并检查了我发送的代码,并在那儿回答与代码无关,建议我清除手机的存储缓存,我也这样做了,并且问题得到解决,

这是来自Firebase支持的邮件

Hi xxxx,

I suggest that you try clearing your phone's cache before proceeding again, its memory might be too high. To do this, go to: Settings -> Storage -> Cached Data. Select it then then choose ok (for clearing the cache). Also please check this the same issue raised on Github and answered by one of our engineers.

If the issue persists after trying the proposed suggestions, please get back to me with a minimal and runnable code that we can use to simulate this, possibly a plunkr or jsfiddle code, or a from the scratch code that can demonstrate the issue.

Regards, xxxx

关于error-handling - 检查推送是否成功-angularfire2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43835548/

相关文章:

asp.net - ASP.NET MVC-验证路由的存在

java - 错误: ORA-00900 Invalid SQLStatement but statement still works as intended

javascript - angular2 翻译 ionic 2 没有 Http 提供者! (我的应用程序 -> 翻译服务 -> Http)

firebase - AngularFireAuth 模拟器登录在页面重新加载时丢失

javascript - 如何重复 Firestore 查询直到满足条件?

excel - 如何使用Application.WorksheetFunction.Match捕获错误并进行处理?

python - 不知道要在 try.. except.. 中放入什么来处理不存在的字符串

php - 如何从MySQL获取图像并使用Angular 2显示

javascript - Angular2 http.post : Create promise with subscribe

Angular2 Firebase 获取当前用户