Renjith V
Posts: 0
Joined: Mon Dec 31, 2012 4:54 am

Manipulate REST output before JSON parsing

I got why the try/catch is not effective. Try is only for invoking the service. The response happens elsewhere in a different thread context.

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

Manipulate REST output before JSON parsing

Delete and then re-create the service. Run it without any custom code, then add your code.

Renjith V
Posts: 0
Joined: Mon Dec 31, 2012 4:54 am

Manipulate REST output before JSON parsing

Ok, let it fail. What eventually happens is that the animation that comes in front of the screen (with the rotating icon) never goes. Is there a way to at least get rid of that?

Renjith V
Posts: 0
Joined: Mon Dec 31, 2012 4:54 am

Manipulate REST output before JSON parsing

You mean only in the data page or even the Service itself from the application?

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

Manipulate REST output before JSON parsing

Service instance and the service.

Renjith V
Posts: 0
Joined: Mon Dec 31, 2012 4:54 am

Manipulate REST output before JSON parsing

Ok, I didn't have succes with anything, now I am calling hideSpinner(); so that the screen is not blocked. A temporary relief.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Manipulate REST output before JSON parsing

Because you can never really trust server response. I always use try/catch before sending response to JSON.parse.
The error your showing is due to failed parse of what was sent to it.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Manipulate REST output before JSON parsing

See whats really comming back first by using the browsers debugging . Maybe add this.
codevar responseTxt =(jqXHR.responseText);/code
This will show content. Arrays within Object etc.

Renjith V
Posts: 0
Joined: Mon Dec 31, 2012 4:54 am

Manipulate REST output before JSON parsing

Btw, I still have not figured out a clean way for this. I tried all the suggestions. I am sure this happens if we create a sample JSON that returns an invalid response. None of the callbacks are called. Possible for anyone to try? I am still on the free plan and hence can create only one project.
Still living with the hideSpinner so that the UI is not blocked. But that is not a clean solution as the loading is actually not complete when I hide it.

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

Manipulate REST output before JSON parsing

Use Chrome Dev. Tools to see if the service is invoked and what it returns.

Return to “Issues”