Cassandra error handling

The session.execute () part of my Cassandra client does not prompt for error handling in eclipse.

session.execute(batch); 

      

Should I manually try to catch.

try
{
session.execute(batch); 
}
catch(Exception e)
{
// Handle error here
}

      

If so, should I handle each request-related error separately?

+3


source to share


1 answer


NoHostAvailableException

, QueryExecutionException

, QueryValidationException

And UnsupportedFeatureException

all extended DriverException

, that is RuntimeException

, who it is out of control exception. From the javadoc for RuntimeException

:

RuntimeException and its subclasses are thrown exceptions. Unchecked exceptions should not be declared in a throws method or constructor expression if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.



This is why eclipse is not giving you a compiler error when you don't handle session.execute with a catch or throw attempt in your method signature.

+4


source







All Articles