/// <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); }
/// <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); }
/// <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); }
/// <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]); } }
/// <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]); } }
/// <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); }
/// <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); }
/// <summary> /// 当路由出现错误时 /// </summary> /// <param name="middleware"></param> /// <returns></returns> public IRoute OnError(Action <IRequest, Exception, IFilterChain <IRequest, Exception> > middleware) { options.OnError(middleware); return(this); }
/// <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); }
/// <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); }