public static MaskItem <Exception?, TMask?>?Combine <TMask>(this MaskItem <Exception?, TMask?>?lhs, MaskItem <Exception?, TMask?>?rhs, Func <TMask, TMask, TMask> combiner) where TMask : class { if (rhs == null) { return(lhs); } if (lhs == null) { return(rhs); } var overall = ExceptionExt.Combine(lhs.Overall, rhs.Overall); TMask?specific; if (lhs.Specific == null) { specific = rhs.Specific; } else if (rhs.Specific == null) { specific = lhs.Specific; } else { specific = combiner(lhs.Specific, rhs.Specific); } if (overall == null && specific == null) { return(null); } return(new MaskItem <Exception?, TMask?>(overall, specific)); }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.Number = this.Number.Combine(rhs.Number); ret.Title = new MaskItem <Exception?, GenderedItem <Exception?>?>(ExceptionExt.Combine(this.Title?.Overall, rhs.Title?.Overall), GenderedItem.Combine(this.Title?.Specific, rhs.Title?.Specific)); ret.Insignia = this.Insignia.Combine(rhs.Insignia); return(ret); }
public override void OnException(ExceptionContext filterContext) { base.OnException(filterContext); var exception = filterContext.Exception; string sbExMsg = ExceptionExt.ExceptionMsg(exception); Exception exp = filterContext.Exception; Type ex = filterContext.Exception.GetType(); //bool eh = true; if (ex.Name == "DbUpdateConcurrencyException") { var e = filterContext.Exception as DbUpdateConcurrencyException; //测试版本并发处理 //e.Entries.Single().Reload(); //测试地址版本测试 //继续测试测试地址001 var entry = e.Entries.Single(); var databaseEntry = entry.GetDatabaseValues(); if (databaseEntry == null) { _errorMsg = "无法保存更改,系已经被其他用户删除."; //filterContext.Result = Failure(_errorMsg); } else { _errorMsg = "无法保存更改,当前记录已经被其他人更改."; //filterContext.Result = Failure(_errorMsg); } } LogEventInfo ei = new LogEventInfo(LogLevel.Error, "", sbExMsg); ei.Properties["stacktrace"] = exception.ExceptionStackTrace(); LogHelper.LogException(ei); //告诉MVC框架异常被处理 filterContext.ExceptionHandled = false; }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.PhaseFragments = new MaskItem <Exception?, IEnumerable <MaskItem <Exception?, ScenePhaseFragment.ErrorMask?> >?>(ExceptionExt.Combine(this.PhaseFragments?.Overall, rhs.PhaseFragments?.Overall), ExceptionExt.Combine(this.PhaseFragments?.Specific, rhs.PhaseFragments?.Specific)); return(ret); }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.Name = this.Name.Combine(rhs.Name); ret.Flags = this.Flags.Combine(rhs.Flags); ret.Properties = new MaskItem <Exception?, IEnumerable <MaskItem <Exception?, ScriptProperty.ErrorMask?> >?>(ExceptionExt.Combine(this.Properties?.Overall, rhs.Properties?.Overall), ExceptionExt.Combine(this.Properties?.Specific, rhs.Properties?.Specific)); return(ret); }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.Types = new MaskItem <Exception?, IEnumerable <MaskItem <Exception?, NpcSoundType.ErrorMask?> >?>(ExceptionExt.Combine(this.Types?.Overall, rhs.Types?.Overall), ExceptionExt.Combine(this.Types?.Specific, rhs.Types?.Specific)); return(ret); }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.Objects = new MaskItem <Exception?, IEnumerable <MaskItem <Exception?, ScriptObjectProperty.ErrorMask?> >?>(ExceptionExt.Combine(this.Objects?.Overall, rhs.Objects?.Overall), ExceptionExt.Combine(this.Objects?.Specific, rhs.Objects?.Specific)); return(ret); }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.Name = this.Name.Combine(rhs.Name); ret.Functions = new MaskItem <Exception?, IEnumerable <MaskItem <Exception?, PexObjectNamedFunction.ErrorMask?> >?>(ExceptionExt.Combine(this.Functions?.Overall, rhs.Functions?.Overall), ExceptionExt.Combine(this.Functions?.Specific, rhs.Functions?.Specific)); return(ret); }
public ErrorMask Combine(ErrorMask?rhs) { if (rhs == null) { return(this); } var ret = new ErrorMask(); ret.OpCode = this.OpCode.Combine(rhs.OpCode); ret.Arguments = new MaskItem <Exception?, IEnumerable <MaskItem <Exception?, PexObjectVariableData.ErrorMask?> >?>(ExceptionExt.Combine(this.Arguments?.Overall, rhs.Arguments?.Overall), ExceptionExt.Combine(this.Arguments?.Specific, rhs.Arguments?.Specific)); return(ret); }
/// <inheritdoc cref="Analyzer{S,M}.ToFailureMetric"/> public override HistogramMetric ToFailureMetric(Exception e) => new HistogramMetric(Column, new Try <Distribution>(ExceptionExt.WrapIfNecessary(e)));