dimanche 19 juillet 2015

Bean validation error not able to catch in Jersey's ExceptionMapper Exception nor Throwable

I would like to use hibernate validator to filter required fields of my DTO's. But when I used Exception or Throwable in my ExceptionMapper, it unable to catch the error from hibernate validator:

@Provider
public class DefaultExceptionMapper<T> implements ExceptionMapper<Throwable> {

@Provider
public class DefaultExceptionMapper<T> implements ExceptionMapper<Exception> {

I can only catch the error from hibernate validator when I use ValidationException.

@Provider
public class DefaultExceptionMapper<T> implements ExceptionMapper<ValidationException> {

Please let me know if it is possible if we can use Throwable or Exception in ExceptionMapper to catch the error from hibernate validator.

Aucun commentaire:

Enregistrer un commentaire