Skip to content

Instantly share code, notes, and snippets.

@explorer14

explorer14/FailoverException.cs Secret

Created Jan 14, 2020
Embed
What would you like to do?
public static class MySqlExceptionExtensions
{
public static bool IsFailoverException(this MySqlException mySqlException)
{
return mySqlException.Number == (int)MySqlErrorCode.UnableToConnectToHost ||
mySqlException.Number == (int)MySqlErrorCode.OptionPreventsStatement ||
(mySqlException.Number == 0 && mySqlException.HResult == -2147467259);
// Fatal error reading from the stream, usually Number being 0 means host connection issues
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.