我正在使用Firebase电话身份验证来验证用户帐户.当我尝试使用错误的验证码进行身份验证时,出现IllegalArgumentException.有没有不用try catch块就能解决的方法?
这是异常消息:
java.lang.IllegalArgumentException: Cannot create PhoneAuthCredential without either verificationProof, sessionInfo, or temporaryProof.
at com.google.android.gms.common.internal.zzbq.checkArgument(Unknown Source)
at com.google.firebase.auth.PhoneAuthCredential.(Unknown Source)
at com.google.firebase.auth.PhoneAuthProvider.getCredential(Unknown Source)
at com.example.myApp.testFragment$3$4.onClick(testFragment.java:316)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20926)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
这是我收到错误的行:
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationCode, inputCode);
我故意在inputCode中使用错误的验证码,并希望得到一条错误消息而不是异常.