示例#1
0
        /// <summary>
        /// 執行Exception過濾器
        /// </summary>
        /// <param name="exceptionFilters"></param>
        /// <param name="ex"></param>
        /// <returns></returns>
        private ExceptionContextModel OnException(IEnumerable <IExceptionFilter> exceptionFilters, Exception ex)
        {
            var excptionContext = new ExceptionContextModel(_callMethod)
            {
                Exception = ex
            };

            foreach (var filter in exceptionFilters)
            {
                filter.OnException(excptionContext);
                if (excptionContext.Result != null)
                {
                    break;
                }
            }

            return(excptionContext);
        }
示例#2
0
 /// <summary>
 /// Called when [exception].
 /// </summary>
 /// <param name="exceptionContext">The exception context.</param>
 public abstract void OnException(ExceptionContextModel exceptionContext);
 public override void OnException(ExceptionContextModel exceptionContext)
 {
     exceptionContext.Result = Message;
 }