示例#1
0
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="onError">错误处理函数</param>
 /// <returns>当前路由组实例</returns>
 public IRouteGroup OnError(Action <IRequest, IResponse, Exception, Action <IRequest, IResponse, Exception> > onError)
 {
     options.OnError(onError);
     for (var i = 0; i < routes.Count; i++)
     {
         routes[i].OnError(onError);
     }
     return(this);
 }
示例#2
0
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="middleware"></param>
 /// <returns></returns>
 public IRouteGroup OnError(Action <IRequest, Exception, IFilterChain <IRequest, Exception> > onError)
 {
     options.OnError(onError);
     for (int i = 0; i < routes.Count; i++)
     {
         routes[i].OnError(onError);
     }
     return(this);
 }
示例#3
0
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="onError">错误处理函数</param>
 /// <param name="priority">优先级(值越小越优先)</param>
 /// <returns>当前路由组实例</returns>
 public IRouteGroup OnError(Action <IRequest, IResponse, Exception, Action <IRequest, IResponse, Exception> > onError, int priority = int.MaxValue)
 {
     Guard.Requires <ArgumentNullException>(onError != null);
     options.OnError(onError);
     for (var i = 0; i < routes.Count; i++)
     {
         routes[i].OnError(onError, priority);
     }
     return(this);
 }
示例#4
0
 /// <summary>
 /// 合并错误时的调度
 /// </summary>
 /// <param name="options"></param>
 protected void MergeOnError(RouteOptions options)
 {
     if (onError == null)
     {
         return;
     }
     IFilter <IRequest, Exception>[] filters = onError.FilterList;
     for (int i = 0; i < filters.Length; i++)
     {
         options.OnError(filters[i]);
     }
 }
示例#5
0
        /// <summary>
        /// 合并错误时的调度
        /// </summary>
        /// <param name="options">外部路由配置</param>
        private void MergeOnError(RouteOptions options)
        {
            if (onError == null)
            {
                return;
            }
            var filters = onError.FilterList;

            for (var i = 0; i < filters.Length; i++)
            {
                options.OnError(filters[i]);
            }
        }
示例#6
0
文件: Route.cs 项目: hongAgain/CatLib
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="middleware"></param>
 /// <returns></returns>
 public IRoute OnError(Action <IRequest, IResponse, Exception, Action <IRequest, IResponse, Exception> > middleware)
 {
     options.OnError(middleware);
     return(this);
 }
示例#7
0
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="onError">执行的处理函数</param>
 /// <returns>路由条目实例</returns>
 public IRoute OnError(Action <IRequest, IResponse, Exception, Action <IRequest, IResponse, Exception> > onError)
 {
     options.OnError(onError);
     return(this);
 }
示例#8
0
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="middleware"></param>
 /// <returns></returns>
 public IRoute OnError(Action <IRequest, Exception, IFilterChain <IRequest, Exception> > middleware)
 {
     options.OnError(middleware);
     return(this);
 }
示例#9
0
文件: Route.cs 项目: U3DC/CatLib
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="onError">执行的处理函数</param>
 /// <returns>路由条目实例</returns>
 public IRoute OnError(Action <IRequest, IResponse, Exception, Action <IRequest, IResponse, Exception> > onError)
 {
     Guard.Requires <ArgumentNullException>(onError != null);
     options.OnError(onError);
     return(this);
 }
示例#10
0
 /// <summary>
 /// 当路由出现错误时
 /// </summary>
 /// <param name="onError">执行的处理函数</param>
 /// <param name="priority">优先级(值越小越优先)</param>
 /// <returns>路由条目实例</returns>
 public IRoute OnError(Action <IRequest, IResponse, Exception, Action <IRequest, IResponse, Exception> > onError, int priority = int.MaxValue)
 {
     Guard.Requires <ArgumentNullException>(onError != null);
     options.OnError(onError, priority);
     return(this);
 }