public static bool IsRpcError(Exception e)
{
int error = Marshal.GetHRForException(e);
// Assume that any 0x8007 is a fatal communication error.
// May need to update this check if the assumption proves to be incorrect.
if ((error & 0xFFFF0000) == 0x80070000)
{
error &= 0xFFFF;
// check the RPC error range define in WinError.h
if (error >= 1700 && error < 1918)
{
return true;
}
}
return false;
}