public bool TryAddNewExceptionInfo([NotNull] TaskMetaInformation taskMeta, [NotNull] Exception exception, out List <TimeGuid> newExceptionInfoIds)
        {
            if (!taskMeta.IsTimeBased())
            {
                throw new InvalidOperationException(string.Format("TaskMeta is not time-based: {0}", taskMeta));
            }
            newExceptionInfoIds = null;
            var newExceptionInfo  = new TaskExceptionInfo(exception);
            var lastExceptionInfo = TryGetLastExceptionInfo(taskMeta);

            if (lastExceptionInfo != null && lastExceptionInfo.ExceptionMessageInfo == newExceptionInfo.ExceptionMessageInfo)
            {
                return(false);
            }
            var      newExceptionInfoId = TimeGuid.NowGuid();
            var      timestamp          = newExceptionInfoId.GetTimestamp().Ticks;
            TimeGuid oldExceptionInfoId;

            newExceptionInfoIds = taskMeta.AddExceptionInfoId(newExceptionInfoId, out oldExceptionInfoId);
            var newExceptionInfoBytes = serializer.Serialize(newExceptionInfo);

            timeBasedBlobStorage.Write(taskMeta.Id, newExceptionInfoId, newExceptionInfoBytes, timestamp, taskMeta.GetTtl());
            if (oldExceptionInfoId != null)
            {
                timeBasedBlobStorage.Delete(taskMeta.Id, oldExceptionInfoId, timestamp);
            }
            return(true);
        }
コード例 #2
0
 private void ShowExceptions(TaskExceptionInfo e)
 {
     WriteToLog(e.TaskException.ToString());
     txtExceptions.Invoke(new Action(() => {
         if (txtExceptions.Text.Length > 50000)
         {
             txtExceptions.ResetText();
         }
         txtExceptions.AppendText(e.TaskName + "\n\n" + e.TaskException.ToString());
     }));
 }
コード例 #3
0
 public void SetExceptionInfo([NotNull] TaskExceptionInfo taskExceptionInfo)
 {
     ExceptionInfos = new[] { taskExceptionInfo };
 }