Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Reply from Login service question

I want to use the error messages received when there. But I not not sure how to get the information.

I am getting this message, which i want to get the code, to action something and print the description:

Image

This is the code I am using to get the messages

precode
error: function(etext) {
$('#loginLabel').text('Error:' + etext.code);
}
/code/pre

I am getting 'undefined'! I also tried etext['code']

Thank you

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Reply from Login service question

Where and how did you define the function? Here is how to handle errors from a service: http://docs.appery.io/documentation/r...

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Reply from Login service question

Yeah, sorry Max, but that really is no help.

textStatus only gives me 'error', errorThrown only gives me 'not found'. Where as still, like my post above, the response from the server is:

code : DBUI110
description: User does not exist

It is those I want to get hold of!

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Reply from Login service question

For direct access to the error response object you have to:

1 Bind Javascript event handler to the "Error" event for login service;
2 Fill this event handler by following code:

pre
code
var responseText = jqXHR.responseText;
var response = JSON.parse(responseText);
console.log("error code = " + response.code);
console.log("error description = " + response.description);
/code
/pre

Return to “Issues”