コード例 #1
0
        private void HandleSendingFailure(State state, string batchId, IngestionException e)
        {
            var isRecoverable = e?.IsRecoverable ?? false;

            AppCenterLog.Error(AppCenterLog.LogTag, $"Sending logs for channel '{Name}', batch '{batchId}' failed: {e?.Message}");
            List <Log> removedLogs;

            using (_mutex.GetLock(state))
            {
                removedLogs = _sendingBatches[batchId];
                _sendingBatches.Remove(batchId);
                if (isRecoverable)
                {
                    _pendingLogCount += removedLogs.Count;
                }
            }
            if (!isRecoverable && FailedToSendLog != null)
            {
                foreach (var log in removedLogs)
                {
                    FailedToSendLog?.Invoke(this, new FailedToSendLogEventArgs(log, e));
                }
            }
            Suspend(state, !isRecoverable, e);
        }
コード例 #2
0
        public void CheckMessageError()
        {
            string             exceptionMessage = "Test exception message";
            IngestionException ingException     = new IngestionException(exceptionMessage);

            Assert.AreEqual(exceptionMessage, ingException.Message);
        }
コード例 #3
0
        private void HandleSendingFailure(string batchId, IngestionException e)
        {
            var isRecoverable = e?.IsRecoverable ?? false;

            MobileCenterLog.Error(MobileCenterLog.LogTag, $"Sending logs for channel '{Name}', batch '{batchId}' failed", e);
            var removedLogs = _sendingBatches[batchId];

            _sendingBatches.Remove(batchId);
            if (!isRecoverable && FailedToSendLog != null)
            {
                foreach (var log in removedLogs)
                {
                    FailedToSendLog?.Invoke(this, new FailedToSendLogEventArgs(log, e));
                }
            }
            _mutex.Lock();
            try
            {
                Suspend(!isRecoverable, e);
                if (isRecoverable)
                {
                    _pendingLogCount += removedLogs.Count;
                }
            }
            finally
            {
                _mutex.Unlock();
            }
        }
コード例 #4
0
        public void CheckInternalError()
        {
            string             exceptionMessage  = "Test exception message";
            Exception          internalException = new Exception(exceptionMessage);
            IngestionException ingException      = new IngestionException(internalException);

            Assert.AreSame(internalException, ingException.InnerException);
            Assert.AreEqual(exceptionMessage, ingException.InnerException.Message);
        }