Reputation: 8972
I am trying to use App Engine with Google Endpoints and I just saw a strange behavior. If I throw exception by:
throw new Exception("MyException");
then if I caught it on the android side in AsyncTask
which is responsible for connect with Endpoint, I simply cannot get a message from it. If I call e.getMessage()
I got something like that:
503 Service Unavailable
[ code: "503",
...
message: "MyException"
]
It is a little bit strange. Is anyone met with this behavior? How can I properly throw Exceptions on App Engine?
Upvotes: 1
Views: 146
Reputation: 15143
What you're seeing is normal and expected.
App Engine only provides HTTP requests to your Android client. Exceptions are not "thrown" over HTTP requests, you only get HTTP responses. You will have to catch the exception on the Google App Engine side, and convert it to an appropriate HTTP error response (if you don't catch it, the default handler gives you a 503 response as you see).
On the Android side, you'll have to check for error results.
Upvotes: 3