你可以扔
Exception
task.getException
在try-catch区块内。所有抛出的例外都在
english
。下面是您使用的方法可能引发的每种类型的异常。
OnCompleteListener
对于
createUserWithEmailAndPassword()
方法请参见以下代码:
if(!task.isSuccessful()) {
try {
throw task.getException();
} catch(FirebaseAuthWeakPasswordException e) {
//do somethig
} catch(FirebaseAuthInvalidCredentialsException e) {
//do somethig
} catch(FirebaseAuthUserCollisionException e) {
//do somethig
} catch(Exception e) {
Log.e("TAG", e.getMessage());
}
}