valchkou / cassandra-driver-mapping

JPA addon for DataStax Java Driver for Cassandra
57 stars 24 forks source link

Possible Exceptions while performing DB operation using Valchkou #64

Open prabhabisht opened 9 years ago

prabhabisht commented 9 years ago

Hi Eugene,

What are the possible exceptions at the time of performing get,save,delete ,updatevalue etc function using valchkou, I need to do some special handling(raise event or some alarm etc). I assumed that it will raise only Driver Exception , but sometimes I am getting UncheckedExecutionException as well . So can you tell me what are the other runtime exceptions Valchkou mapper throws so I can handle them accordingly.

valchkou commented 9 years ago

I don't have defined exceptions in my module. and you are correct, you can only code logic for datastax defined exceptions. If you see something else please report here and I will take a look

vikbhati commented 9 years ago

Hi Eugene,

We started with catching DriverException in all the methods as it covers most of the exception scenarios related to database. But We got UncheckedExecutionException in one of the cases while performing a GET operation. So we started catching generic exception also in all the methods. Do you think catching driver Exception should suffice all the scenarios or we should catch the generic exception also?

valchkou commented 9 years ago

Hi, What are those UncheckedExecutionExceptions? could you provide stacktrace please? This is regular java program which can through any type of UncheckedExecutionException, like NullPointer. The question is why? if this happens because of your bug or data this is your decision how to handle it. But if this is bug in my module I will try to fix it shortly.

SusilPanda commented 9 years ago

Hi, The exception I am getting while fetching employee details using get method. Example : I have an employee column family CF : Employee emp_id emp_name emp_address 1234 abc India

Now I run the below query : Employee employee = mapper.get(employeeDto);

Exception scenario : My CF has been dropped when I run the above query. In this case I expect the exception will be InvalidQueryException, but UncheckedExecutionExceptions is thrown. com.google.common.util.concurrent.UncheckedExecutionException - com.datastax.driver.core.exceptions.InvalidQueryExceptions .

InvalidQueryExceptions is wrapped in the UncheckedExecutionException.

Is it clear now ?