if (x instanceof WriteTimeoutException) {
WriteType writeType = ((WriteTimeoutException) x).getWriteType();
return new CassandraWriteTimeoutException(writeType == null ? null : writeType.name(), x.getMessage(), x);
}
if (x instanceof TruncateException) {
return new CassandraTruncateException(x.getMessage(), x);
}
if (x instanceof UnavailableException) {
UnavailableException ux = (UnavailableException) x;
return new CassandraInsufficientReplicasAvailableException(ux.getRequiredReplicas(), ux.getAliveReplicas(),
x.getMessage(), x);