Reputation: 557
Hi I read the tutorials on basic parse features, etc. and I am using the ParseUser feature. From the tutorial this is shown :
ParseUser.logInInBackground("Jerry", "showmethemoney", new LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
// Hooray! The user is logged in.
} else {
// Signup failed. Look at the ParseException to see what happened.
}
}
});
I was wondering how I could look at the ParseException to see what happened. For example, I want to inform the user that a bad username was entered, or a bad password.
Thank you
Upvotes: 2
Views: 1433
Reputation: 91
a Pretty easy way to resolve this is to use
e.getMessage();
// this probably shows you appropriate message
// or you can use
e.getCode();
// and match code with the integers given in Parse Doucmentation
// for example.
// e.EMAIL_NOT_FOUND is code for when email is not found in registered users class
Upvotes: 3
Reputation: 46
if you need see the exception, can try show in the log or where you decide, in your code for te show in the log where Log.d(nameofalert,mensaje), only need see the logcat for the identify your exception
ParseUser.logInInBackground("Jerry", "showmethemoney", new LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
Log.d("user not null",e.toString());
} else {
Log.d("error",e.toString());
// Signup failed. Look at the ParseException to see what happened.
}
}
});
Upvotes: 1
Reputation: 755
how about just doing e.printStackTrace()
, that will print all the information that you need pertaining to the exception
Upvotes: 1
Reputation: 20155
Place your code in between try catch and in the catch block try to handle stuff that will go when user enter bad username or password
try{
}
catch(ParseException e)
{
// do stuff here
}
Upvotes: 1