Пример #1
0
        /// <summary>
        /// Called when [exception asynchronous].
        /// </summary>
        /// <param name="actionExecutedContext">The action executed context.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public virtual Task OnExceptionAsync(RpcActionExecutedContext actionExecutedContext,
                                             CancellationToken cancellationToken)
        {
            try
            {
                OnException(actionExecutedContext);
            }
            catch (Exception ex)
            {
                return(TaskHelpers.FromError(ex));
            }

            return(TaskHelpers.Completed());
        }
Пример #2
0
 private async Task ExecuteExceptionFilterAsyncCore(RpcActionExecutedContext actionExecutedContext,
                                                    CancellationToken cancellationToken)
 {
     await OnExceptionAsync(actionExecutedContext, cancellationToken);
 }
Пример #3
0
 /// <summary>
 /// Called when [exception].
 /// </summary>
 /// <param name="actionExecutedContext">The action executed context.</param>
 public virtual void OnException(RpcActionExecutedContext actionExecutedContext)
 {
 }
Пример #4
0
 /// <summary>
 /// 异步执行异常过滤器.
 /// </summary>
 /// <param name="actionExecutedContext">The action executed context.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>Task.</returns>
 Task IExceptionFilter.ExecuteExceptionFilterAsync(RpcActionExecutedContext actionExecutedContext,
                                                   CancellationToken cancellationToken)
 {
     Check.NotNull(actionExecutedContext, "actionExecutedContext");
     return(ExecuteExceptionFilterAsyncCore(actionExecutedContext, cancellationToken));
 }