exception handling - What is the correct way to configure custom mapper for WebApplicationException? -
i've created class implements implements exceptionmapper<webapplicationexception> , registered environment.addprovider(new webapplicationexceptionmapper());. custom mapper works exceptions extended webapplicationexception. example doesn't work conflictexception , doesn't work custom exceptions following constructor:
public conflictexception(uri location, object entity) { super(response.status(response.status.conflict).location(location).entity(entity).build()); } it work if i'll remove super(response.status..... strange , can't explain this. i'm not sure jersey or dropwizard behaviour.
what correct way configure mapper webapplicationexception , subclasses? can explain problems have?
may little late, found work.
for dropwizard 0.8 , above
in yaml configuration
server: registerdefaultexceptionmappers: false this disable dws default exception mapper, add own exception mappers
// register custom exceptionmapper(s) environment.jersey().register(new resterrorshandler()); source: github issue
Comments
Post a Comment