Here is an issue i’m struggling to solve for quit some time now.
I have a python + GAE backend with a flex client that communicates via JSON. I’m using flex’s HttpService bound to a Responder with result and fault callbacks.
When python raises an exception, I don’t seem to get it in flex. I did some research and found out that the problem probably lies in the fact that the flash runtime cannot handle http responses with status code other than 200.
So how do I get those exceptions in the client?
Thanks
TL;DR – Catch exception in Python and send a custom JSON object, with the message you want to display to the client, back to Flex.
This is the pattern I follow. The example I am going to give is in C# but I am assuming the same principles can be applied to Python.
I handle the exception in the web service and send a JSON object containing the error I would like to display to the user.
Here I am catching the error:
Here is the return object I use to convert to JSON and return to the client:
Using this method will always return a 200 unless there is something wrong with your web server, the connection between the client and web server, or gremlins have infected your machine.
As for the flex side, here are my result handlers: