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.
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.
Delete and then re-create the service. Run it without any custom code, then add your code.
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?
You mean only in the data page or even the Service itself from the application?
Service instance and the service.
Ok, I didn't have succes with anything, now I am calling hideSpinner(); so that the screen is not blocked. A temporary relief.
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.
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.
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.
Use Chrome Dev. Tools to see if the service is invoked and what it returns.