AnsweredAssumed Answered

ResponseStatus object returned by a remote.call method

Question asked by soldiertt on Jul 17, 2014
Latest reply on Jul 18, 2014 by soldiertt
Hi,


I have a complete application based on webscripts, it is using Alfresco Share webscripts for front end calling repository webscripts.
Typical share webscript looks like :

var json = remote.call("/imaging/document/parentdoc");
if (json.status == 200) {
   //Do stuff
} else {
   logger.log("Error …..");
   //Manage error code
   json.status.message // here i want the backend message but empty :-(
}

When repo webscript looks like :

// business code
if (contentNode.typeShort == "fds:content") {
   //business code
} else {
   status.code = 400;
   status.message = "Bad request : node is not a content !";
   status.redirect = true;
}

So we are able to retrieve the return status code (400), but i would like to also retrieve the status message !!!
That would be very handy to have this message back to the front end, so we can be aware of the root cause message.

Documentation http://wiki.alfresco.com/wiki/Surf_Platform_-_Freemarker_Template_and_JavaScript_API#Response
seems to say that info is available but when in my share webscript i try :
json.status.message // it returns empty string
json.status.redirect // return false where it should be true
json.status.code // return correct response code like 'json.status'


thank you for your help

Outcomes