How to check value of "Why" in caught exception from executing CQL query?

Apr 21, 2013 at 2:55 AM
Hello,

thanks for creating cassandraemon! I have started using it today and I just wonder if there is any way to read "Why" value in exception being caught from executing CQL query?

When I do the following:
try
{
    CqlResult createResult = context.ExecuteCqlQuery(createTableCql);
}
catch (Exception exc)
{
    if (exc.Why.Contains("already existing"))
    { // org.apache.cassandra.exceptions.AlreadyExistsException: Cannot add already existing column family "nameOfColumn" to keyspace "nameOfKeyspace"
    }
}
I cannot access Why in exc in any way.

I know I can check if table exists like here (http://stackoverflow.com/questions/16016946/how-to-check-if-a-cassandra-table-exists), however only in CQL3. But I would like to know how to read content of "Why" in general because I may need it in other context in the future. And it does not simply return some kind of CqlResult value that I can check, it just throws an exception.

How to check value of "Why" in caught exception from executing CQL query?

Regards!