Re: How to handle a Python server-side Exception in GWT client code?
You can't just simply handle server side exception in GWT especially when you deal with non-JAVA backends (GWT RPC/RequestFactory have ways to translate server side exceptions to the client side exceptions).
So you have to roll your own exception translation.
You can catch exceptions in your python application sever and then use a custom response code (or re-use response code 500) together with specific statustext (maybe a JSON response containing the server side message of the exception and the type).
On the GWT client you have to check the statuscode and the statustext (parse the JSON) and raise a GWT exception or handle it directly there.
On Thursday, April 11, 2013 11:39:16 AM UTC+2, Carl wrote:
One less layer...I'm using RequestBuilder's sendRequest and handling errors in that call's onResponseReceived(Request req, Response resp)That function still has flatten the server's exception to resp.getStatusCode() of 500 and resp.getStatusText() of "INTERNAL SERVER ERROR".What approach could I take to get access to the server's raised NotUniqueException ?
On Thursday, 11 April 2013 09:32:14 UTC+1, Carl wrote:I'm using AsyncCallback<String>() to handle JSON replies from my Python-backed server.If the server throws a custom exception, NotUniqueException my client code AsyncCallback.onFailure(Throwable caught) is called. In the GWT client code, how do I gain access to NotUniqueException? Or at least know that this type of exception was thrown?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home