|
23 | 23 |
|
24 | 24 | import org.springframework.dao.DataAccessException;
|
25 | 25 | import org.springframework.dao.DataAccessResourceFailureException;
|
| 26 | +import org.springframework.dao.QueryTimeoutException; |
26 | 27 | import org.springframework.dao.TransientDataAccessResourceException;
|
27 | 28 | import org.springframework.dao.support.PersistenceExceptionTranslator;
|
28 | 29 | import org.springframework.data.cassandra.CassandraAuthenticationException;
|
29 | 30 | import org.springframework.data.cassandra.CassandraConnectionFailureException;
|
| 31 | +import org.springframework.data.cassandra.CassandraDriverTimeOutException; |
30 | 32 | import org.springframework.data.cassandra.CassandraInsufficientReplicasAvailableException;
|
31 | 33 | import org.springframework.data.cassandra.CassandraInvalidConfigurationInQueryException;
|
32 | 34 | import org.springframework.data.cassandra.CassandraInvalidQueryException;
|
|
43 | 45 |
|
44 | 46 | import com.datastax.oss.driver.api.core.AllNodesFailedException;
|
45 | 47 | import com.datastax.oss.driver.api.core.DriverException;
|
| 48 | +import com.datastax.oss.driver.api.core.DriverTimeoutException; |
46 | 49 | import com.datastax.oss.driver.api.core.auth.AuthenticationException;
|
47 | 50 | import com.datastax.oss.driver.api.core.metadata.Node;
|
48 | 51 | import com.datastax.oss.driver.api.core.servererrors.AlreadyExistsException;
|
|
70 | 73 | * @author Alex Shvid
|
71 | 74 | * @author Matthew T. Adams
|
72 | 75 | * @author Mark Paluch
|
| 76 | + * @author Mikhail Polivakha |
73 | 77 | */
|
74 | 78 | @SuppressWarnings("unchecked")
|
75 | 79 | public class CassandraExceptionTranslator implements CqlExceptionTranslator {
|
@@ -105,6 +109,10 @@ public DataAccessException translate(@Nullable String task, @Nullable String cql
|
105 | 109 | exception);
|
106 | 110 | }
|
107 | 111 |
|
| 112 | + if (exception instanceof DriverTimeoutException driverTimeoutException) { |
| 113 | + return new CassandraDriverTimeOutException(driverTimeoutException.getMessage(), driverTimeoutException); |
| 114 | + } |
| 115 | + |
108 | 116 | if (exception instanceof ReadTimeoutException) {
|
109 | 117 | return new CassandraReadTimeoutException(((ReadTimeoutException) exception).wasDataPresent(), message, exception);
|
110 | 118 | }
|
@@ -178,7 +186,6 @@ public DataAccessException translate(@Nullable String task, @Nullable String cql
|
178 | 186 | // unknown or unhandled exception
|
179 | 187 | return new CassandraUncategorizedException(message, exception);
|
180 | 188 | }
|
181 |
| - |
182 | 189 | return null;
|
183 | 190 | }
|
184 | 191 |
|
|
0 commit comments