我正在使用firebase 3.4.1 - 我正在使用谷歌登录进行身份验证的应用程序。 一切都很好,但为什么控制台在函数onAuthStateChanged()之后没有显示任何错误?
当我通过调用其中的不存在的函数强制执行错误时,控制台不显示任何内容,但脚本会按预期停止。
firebase.auth().onAuthStateChanged(function(user) {
fghfg();
if (user) {
account.init(user);
} else {
account.init();
}
});
fghfg()将停止脚本。但是没有日志消息?!
任何想法?
答案 0 :(得分:0)
解决。
我现在正在使用这个firebase-intern问题的解决方法。 刚刚在“onAuthStateChanged()”中放置了一个try-catch-block。其中的所有错误现在都将被控制台记录。希望它会帮助别人。
firebase.auth().onAuthStateChanged(function(user) {
try {
if (user) {
account.init(user);
} else {
account.init();
}
} catch (e) {
console.error(e);
}
});