Opc.Ua.Com.ComUtils.IsRpcError C# (CSharp) Method

IsRpcError() public static method

Checks if the error is an RPC error.
public static IsRpcError ( Exception e ) : bool
e System.Exception
return bool
        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;
        }