Redis
 sql >> Base de données >  >> NoSQL >> Redis

Comment attraper redis.serializer.SerializationException

Vous pouvez gérer les exceptions avec Spring AOP, @Aspect

    public class ErrorInterceptor{
    @AfterThrowing(pointcut = "execution(* your.package..* (..))", throwing = "ex")
    public void errorInterceptorForSerializationException(SerializationException ex) {
        // DO SOMETHING HERE WITH EX
        logger.error( ex.getCause().getMessage());
    }
 @AfterThrowing(pointcut = "execution(* your.package..* (..))", throwing = "ex")
    public void errorInterceptorForSerializationFailedException(SerializationFailedException ex) {
        // DO SOMETHING HERE WITH EX
        logger.error( ex.getCause().getMessage());
    }
    }