How to prevent/handle 500 and 404 error

28 views
Skip to first unread message

Kotuboy

unread,
Oct 19, 2011, 9:58:34 AM10/19/11
to google-we...@googlegroups.com
Hi,

It is a general question to understand the logic behind rpc call.
I have many rpc interfaces like (XService, XserviceAsync), (Yservice, YServiceAsync)... and the service classes on the Server part.
I want to catch all errors and exceptions and show the client a meanigful message.

How can I do that?
Currently I get for example the following message



Filipe Sousa

unread,
Oct 20, 2011, 5:21:54 AM10/20/11
to google-we...@googlegroups.com
One option is to extend AsyncCallback to catch all exceptions onFailure(). Then use the new extended class in each callback.

Example from AsyncCallback java doc:

public void onFailure(Throwable caught) {
     // Convenient way to find out which exception was thrown.
     try {
       throw caught;
     } catch (IncompatibleRemoteServiceException e) {
       // this client is not compatible with the server; cleanup and refresh the 
       // browser
     } catch (InvocationException e) {
       // the call didn't complete cleanly
     } catch (ShapeException e) {
       // one of the 'throws' from the original method
     } catch (DbException e) {
       // one of the 'throws' from the original method
     } catch (Throwable e) {
       // last resort -- a very unexpected exception
     }
   }
 });
Reply all
Reply to author
Forward
0 new messages