Reputation: 79
Is there any way to catch the connection exception thrown by the datastax cassandra driver for C#? It usually works fine, but the catch block does not execute when the remote host is down (that is, when a NoHostAvailableException is thrown). The debugger only halts and indicates the exception at Connect().
try
{
cluster = Cluster.Builder().AddContactPoint("<ip address>").Build();
session = (Session)cluster.Connect();
}
catch (NoHostAvailableException ex)
{
//Never executes
}
catch (Exception ex)
{
//Never executes
}
Upvotes: 2
Views: 680
Reputation: 79
Found the fix, Visual Studio has a checkbox where you can choose whether or not you want to break on a certain exception (regardless of a try/catch), unchecking that solved everything.
Upvotes: 1