title: How do I use a Jersey ExceptionMapper with Google Guice?
body: <p>I am using Jersey Guice and need to configure a custom <code>ExceptionMapper</code></p>
  
  <p>My module looks like this:</p>
  
  <pre><code>public final class MyJerseyModule extends JerseyServletModule
  {
     @Override
     protected void configureServlets()
     {
        ...
        filter("/*").through(GuiceContainer.class);
        ...
     }
  }
  </code></pre>
  
  <p>And this is my <code>ExceptionMapper</code>:</p>
  
  <pre><code>import javax.ws.rs.core.Response;
  import javax.ws.rs.core.Response.Status;
  import javax.ws.rs.ext.ExceptionMapper;
  
  public class MyExceptionMapper implements ExceptionMapper&lt;MyException&gt;
  {
     @Override
     public Response toResponse(final MyException exception)
     {
        return Response.status(Status.NOT_FOUND).entity(exception.getMessage()).build();
     }
  }
  </code></pre>