I’m wondering

Handling Parse.com Rest API error responses with Appery.io

Hello,

I'm using Parse.com and its User class as a backend for my app.
I'm registering users from my app with a simple registration form, and sending the data with a "before send" mapping.



If the registration is ok, Parse.com returns a response formatted as follows:

{
"createdAt":"2014-10-26T08:00:15.313Z",
"objectId":"3VpzQXjtnq",
"sessionToken":"PxQALvjdLxpAskgvL276MQbKD"
}

I can easily get the objectId from the "Success" event :

alert(data.objectId);



However, if a user registers with an email address that is already in the Parse database, it throws me an error as a response :

{
"status":400,
"uri":"https://api.parse.com/1/users",
"response":{
"code":203,
"error":"the email address test@test.com has already been taken"
}
}

or if the username is already taken...

{
"status":400,
"uri":"https://api.parse.com/1/users",
"response":{
"code":202,
"error":"username test already taken"
}
}

I would like to get/manipulate the error code (203 or 202), to display a custom error message to the user.
I can't find how to do this from the "Error" event (or elsewhere)



Can you help me please?
1 person has
this question
+1
This topic is no longer open for comments or replies.