Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Idea] Callback with ParseException #37

Closed
ghost opened this issue Jan 18, 2019 · 2 comments
Closed

[Idea] Callback with ParseException #37

ghost opened this issue Jan 18, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 18, 2019

Hi,

I think it could be a good idea if for maybe most of functions (signup, reset password, cloud codes functions, etc.), we can have a callback with firstly the object(s) and secondly the ParseException, like this example (from the official docs: https://docs.parseplatform.org/android/guide/#retrieving-objects) :

ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("gender", "female");
query.findInBackground(new FindCallback<ParseUser>() {
  public void done(List<ParseUser> objects, ParseException e) {
    if (e == null) {
        // The query was successful.
    } else {
        // Something went wrong.
    }
  }
});

And

ParseUser.requestPasswordResetInBackground("myemail@example.com", new RequestPasswordResetCallback() {
  public void done(ParseException e) {
    if (e == null) {
      // An email was successfully sent with reset instructions.
    } else {
      // Something went wrong. Look at the ParseException to see what's up.
    }
  }
});

With this, if we sign up a user and there is an error, we know which error is because for the moment, we can't know why it fails.

@phillwiggins
Copy link
Member

Okay so this is definitely something we can do. I did originally take this approach but then removed it as it added a lot of boiler plate code... however, after writing my own app using this library, I do feel that it's something that is needed.

This will be a breaking change but will be added.

I'm not 100% when the ParseUser queries will be added, but a ParseResponse object can be the return type for a ParseUser request.

@phillwiggins
Copy link
Member

phillwiggins commented Jan 18, 2019

You were correct in this idea and this has now been implemented. It's on the develop branch and will be released with 1.0.6.

If you check the updated example code, there's now examples of the user being returned as a ParseResponse which contains user and exception details. There's also a working example of a query based on a user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant