Using Firebase, how do I catch a specific exception and tell the user gracefully about it? E.g :
FirebaseAuthInvalidCredentialsException: The email ad
try { throw task.getException(); } catch(FirebaseAuthException e) { switch (e.getErrorCode()){ case "ERROR_WEAK_PASSWORD": Toast.makeText(this, "The given password is invalid.", Toast.LENGTH_SHORT).show(); break; //and other } }
error codes: https://stackoverflow.com/a/38244409/2425851