Skip to content

Instantly share code, notes, and snippets.

@joao-r-reis
Created October 31, 2020 13:32
Show Gist options
  • Save joao-r-reis/50e69c41d6a9d05c3c7b72a66fd96883 to your computer and use it in GitHub Desktop.
Save joao-r-reis/50e69c41d6a9d05c3c7b72a66fd96883 to your computer and use it in GitHub Desktop.
TryCatch.cs
ISession session;
try
{
session = cluster.Connect();
}
catch (NoHostAvailableException ex)
{
var innerExceptions = ex.Errors.Select(
kvp => $"Host: {kvp.Key}; Message: {kvp.Value.Message}; StackTrace: {kvp.Value.StackTrace}");
log.Error($"{ex.Message};{innerExceptions}");
throw;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment