Handling undeclared exceptions on the server side.

4 views
Skip to first unread message

Jason Essington

unread,
Aug 16, 2006, 1:53:00 PM8/16/06
to Google-We...@googlegroups.com
I've run into many circumstances where I would like to do something
with (usually just log) undeclared exceptions (on the server side)
when performing an rpc.

It would be nice if RemoteServiceServlet had another hook:

protected void onUndeclaredException(Throwable caught) {
}

then in the processCall method:

// Serialize the exception back to the client if it's a
declared exception
if (isExpectedException(serviceIntfMethod, cause)) {
Class thrownClass = cause.getClass();
responsePayload = createResponse(streamWriter,
thrownClass, cause,
true);
// Don't log the exception on the server
caught = null;
} else {
// Notify subclass that an undeclared exception has been
thrown
onUndelaredException(caught);
}

-jason

Reply all
Reply to author
Forward
0 new messages