コード例 #1
0
        internal static void SetException(TaskSlim tcs, AmqpError error, int classMethodId)
        {
            if (tcs == null)
            {
                return;
            }
            if (error != null)
            {
                tcs.SetException(new Exception("Error: " + error.ToErrorString()));
            }
            else if (classMethodId == 0)
            {
                tcs.SetException(new Exception("The server closed the connection"));
            }
            else
            {
                var classId  = classMethodId >> 16;
                var methodId = classMethodId & 0x0000FFFF;

                Console.WriteLine("Unexpected situation: classId = " + classId + " method " + methodId + " and error = null");
                tcs.SetException(new Exception("Unexpected reply from the server: classId = " + classId + " method " + methodId));
            }
        }
コード例 #2
0
        internal static void SetException <T>(TaskCompletionSource <T> tcs, AmqpError error, int classMethodId)
        {
            if (tcs == null)
            {
                return;
            }
            if (error != null)
            {
                tcs.TrySetException(new Exception("Error: " + error.ToErrorString()));
            }
            else if (classMethodId == 0)
            {
                tcs.TrySetException(new Exception("The server closed the connection"));
            }
            else
            {
                var classId  = classMethodId >> 16;
                var methodId = classMethodId & 0x0000FFFF;

                LogAdapter.LogError(LogSource, "Unexpected situation: classId " + classId + " method " + methodId + " and error = null");

                tcs.TrySetException(new Exception("Unexpected reply from the server: classId = " + classId + " method " + methodId));
            }
        }