Sunday, May 29, 2011

Re: More logs on requestfactory ?

Your implementation on the server very likely throws a
NullPointerException. The message "Server Error:" is prefixed by the
DefaultExceptionHandler. You can replace the latter with a custom
version that logs all exceptions. Therefore you have to provide a
custom version of the RequestFactoryServlet. Here's an example:

public class CustomRequestFactoryServlet extends RequestFactoryServlet
{

static class LoquaciousExceptionHandler implements ExceptionHandler
{
private static final Logger LOG =
LoggerFactory.getLogger( LoquaciousExceptionHandler.class );

@Override
public ServerFailure createServerFailure( Throwable throwable ) {
LOG.error( "Server error", throwable );
return new ServerFailure( throwable.getMessage(),
throwable.getClass().getName(), null, true );
}
}

public CustomRequestFactoryServlet() {
super( new LoquaciousExceptionHandler() );
}
}

More information: http://cleancodematters.wordpress.com/2011/05/29/improved-exceptionhandling-with-gwts-requestfactory/

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment