Skip to content
Snippets Groups Projects
Commit 1fa18b5f authored by Sören Henning's avatar Sören Henning
Browse files

handle InvalidQueryException

parent c34533e7
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ import org.springframework.stereotype.Service; ...@@ -4,6 +4,7 @@ import org.springframework.stereotype.Service;
import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Session; import com.datastax.driver.core.Session;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import com.datastax.driver.core.exceptions.NoHostAvailableException; import com.datastax.driver.core.exceptions.NoHostAvailableException;
@Service @Service
...@@ -19,7 +20,7 @@ public class CassandraService { ...@@ -19,7 +20,7 @@ public class CassandraService {
try { try {
final Cluster cluster = Cluster.builder().addContactPoint(IP_ADDRESS).withPort(PORT).build(); final Cluster cluster = Cluster.builder().addContactPoint(IP_ADDRESS).withPort(PORT).build();
this.session = cluster.connect(KEYSPACE); this.session = cluster.connect(KEYSPACE);
} catch (NoHostAvailableException exception) { } catch (NoHostAvailableException | InvalidQueryException exception) {
this.session = null; this.session = null;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment