Unexpected server to client exception translation occurring

39 views
Skip to first unread message

Adam Gordon

unread,
Apr 10, 2012, 11:26:19 AM4/10/12
to google-we...@googlegroups.com
We're building some internal web applications for divisions and we have a need to send any server side stack traces to the client so that when employee end-users encounter errors they can put a stacktrace in our ticketing system.

I have registered my own GWT.UncaughtExceptionHandler that recursively iterates over the throwable (and any nested throwables/exceptions) to generate a stacktrace and then, for now, puts this in a dialog.  This code is working but the behavior I am seeing is that the exception thrown on the server is not what is being displayed.  It's like it's being translated.

Anyone have any idea what's going on here and how to fix it?  Thanks.

--adam

Adam Gordon

unread,
Apr 10, 2012, 12:29:58 PM4/10/12
to google-we...@googlegroups.com
Ok, I figured out what's going on here.  Checked exceptions appear to be handled automatically by GWT and thrown to the client (not sure what happens here if they're not serializable).

Unchecked exceptions are processed by AbstractRemoteServiceServlet.doUnexpectedFailure(Throwable).  There does not appear to be a way to register a global exception handler so a base class overriding this method was necessary.  Additionally, this method defers to RPCServletUtils.writeResponseForUnexpectedFailure(...) to write the response to the server.  This utility method essentially ignores the error thrown on the server and writes a generic response.

The solution was to override the method and rather than call the RPCServletUtils method, to copy and tweak it so that it sends back the message I need to send.
Reply all
Reply to author
Forward
0 new messages