示例#1
0
        private JobError SetJobError(Job job, JobTask task)
        {
            var err = new JobError
            {
                AppID  = job.AppID,
                JobID  = job.ID,
                TaskID = task.ID,
                Start  = task.Start,
                End    = task.End,
                Data   = task.Data,

                Server    = task.Server,
                ProcessID = task.ProcessID,
                Client    = task.Client,

                CreateTime = DateTime.Now,
                UpdateTime = DateTime.Now,
            };

            var msg = task.Message;

            if (!msg.IsNullOrEmpty() && msg.Contains("Exception:"))
            {
                msg = msg.Substring("Exception:").Trim();
            }
            err.Message = msg;

            err.Insert();

            return(err);
        }
示例#2
0
        private JobError SetJobError(IJob job, JobLog ji, IDictionary <String, Object> ps)
        {
            var err = new JobError
            {
                AppID      = job.AppID,
                JobID      = job.ID,
                Start      = ji.Start,
                End        = ji.End,
                Row        = ji.Row,
                Step       = ji.Step,
                BatchSize  = ji.BatchSize,
                CreateTime = DateTime.Now,
                UpdateTime = DateTime.Now,
                Server     = ji.Server,
                ProcessID  = ji.ProcessID,
                ThreadID   = ji.ThreadID,
                Client     = ji.Client,
            };

            err.Key = ji.Key;

            err.Data = ps["Data"] + "";

            var code = ps["ErrorCode"] + "";

            if (code != nameof(Exception))
            {
                code = code.TrimEnd(nameof(Exception));
            }
            err.ErrorCode = code;

            var msg = ji.Message;

            if (!msg.IsNullOrEmpty() && msg.Contains("Exception:"))
            {
                msg = msg.Substring("Exception:").Trim();
            }
            err.Message = msg;

            err.Insert();

            return(err);
        }