I’m trying to log client’s exceptions on the server side. So I need to send them from client to server.
I have created service for this purpose:
public interface LoggerService extends RemoteService {
void logerror(Throwable e);
}
On the client’s side I use GWT.setUncaughtExceptionHandler(uncaughtExceptionHandler):
GWT.UncaughtExceptionHandler uncaughtExceptionHandler = new
GWT.UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
LoggerServiceAsync loggerService = GWT.create(LoggerService.class);
loggerService.logerror(e, new AsyncCallback<Void>() {
@Override
public void onSuccess(Void arg0) {
SC.say("Client's error logged");
}
@Override
public void onFailure(Throwable arg0) {
SC.say("Unable to log client's error");
}
});
}
};
When I’m using hosted mode it works fine. But when I’m trying to work with web mode My LoggerService doesn’t work. I know that in hosted mode exception “translates” from js to java. But I can’t understand, why my logerror(Throwable e) method doesn’t invoke at all in web mode. Server responce is 200.
Finally I added gwt-log for logging client’s exceptions on server.