using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Unity.Interception.PolicyInjection.Pipeline; namespace Txgy.EWS.Client.Log.Aop.Attributes { public class ExceptionHandler : ICallHandler { LogHelper LogHelper = new LogHelper(); public int Order { get; set; } public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) { IMethodReturn methodReturn = null; // 登录检查 Web methodReturn = getNext().Invoke(input, getNext);// 方法体 if (methodReturn.Exception != null) { // 保存日志 LogHelper.Error(input.Target, "LogBeforeHandler Hello"); } return methodReturn; } } }