+ wire to Spring DAO exception translation
This commit is contained in:
@@ -23,8 +23,7 @@ import org.springframework.dao.DataAccessResourceFailureException;
|
||||
*
|
||||
* @author Mark Pollack
|
||||
*/
|
||||
public class CannotGetRedisConnectionException extends
|
||||
DataAccessResourceFailureException {
|
||||
public class CannotGetRedisConnectionException extends DataAccessResourceFailureException {
|
||||
|
||||
public CannotGetRedisConnectionException(String msg) {
|
||||
super(msg);
|
||||
@@ -33,5 +32,4 @@ public class CannotGetRedisConnectionException extends
|
||||
public CannotGetRedisConnectionException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.datastore.redis.core.jedis;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.datastore.redis.support.RedisPersistenceExceptionTranslator;
|
||||
|
||||
/**
|
||||
@@ -25,11 +26,14 @@ import org.springframework.datastore.redis.support.RedisPersistenceExceptionTran
|
||||
* @author Mark Pollack
|
||||
*
|
||||
*/
|
||||
public class JedisPersistenceExceptionTranslator implements
|
||||
RedisPersistenceExceptionTranslator {
|
||||
public class JedisPersistenceExceptionTranslator implements RedisPersistenceExceptionTranslator,
|
||||
PersistenceExceptionTranslator {
|
||||
|
||||
public DataAccessException translateException(Exception ex) {
|
||||
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.datastore.redis.support.RedisPersistenceExceptionTranslator;
|
||||
|
||||
public class JRedisPersistenceExceptionTranslator implements
|
||||
RedisPersistenceExceptionTranslator {
|
||||
public class JRedisPersistenceExceptionTranslator implements RedisPersistenceExceptionTranslator {
|
||||
|
||||
public DataAccessException translateException(Exception ex) {
|
||||
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.springframework.dao.DataAccessException;
|
||||
*/
|
||||
public interface RedisPersistenceExceptionTranslator {
|
||||
|
||||
|
||||
//NOTE some client libraries throw checked exceptions.
|
||||
DataAccessException translateException(Exception ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user