Exemple #1
0
        /// <summary>
        /// If current call is cancelled invokes OnOperationCancelled, otherwise invokes ThrowOrIgnoreCore.
        /// </summary>
        /// <param name="context">The context associated with the current call.</param>
        /// <param name="detail">The exception details.</param>
        public virtual void ThrowOrIgnore(ClientCallInterceptorContext context, ClientFaultDetail detail)
        {
            // the request is already aborted, no extra details are available from server
            if (IsOperationCancelled(context, detail.OriginalError))
            {
                OnOperationCancelled(context, detail.OriginalError);
            }

            ThrowOrIgnoreCore(context, detail);
        }
Exemple #2
0
        public void BeforeEachTest()
        {
            _sut = new Mock <ClientErrorHandlerBase> {
                CallBase = true
            };

            _tokenSource = new CancellationTokenSource();

            var method = new Mock <IMethod>(MockBehavior.Strict);

            _callContext = new ClientCallInterceptorContext(new CallOptions(new Metadata(), cancellationToken: _tokenSource.Token), null, method.Object);

            _faultDetail = new ClientFaultDetail(new RpcException(Status.DefaultCancelled), new object());
        }
Exemple #3
0
 /// <summary>
 /// Handle the exception that was raised by <see cref="CallInvoker"/>.
 /// </summary>
 /// <param name="context">The context associated with the current call.</param>
 /// <param name="detail">The exception details.</param>
 protected abstract void ThrowOrIgnoreCore(ClientCallInterceptorContext context, ClientFaultDetail detail);
Exemple #4
0
        /// <summary>
        /// Invokes ThrowOrIgnore of handlers in the pipeline ony by one.
        /// </summary>
        /// <param name="context">The context associated with the current call.</param>
        /// <param name="detail">The exception details.</param>
        protected override void ThrowOrIgnoreCore(ClientCallInterceptorContext context, ClientFaultDetail detail)
        {
            for (var i = 0; i < _pipeline.Count; i++)
            {
                var handler = _pipeline[i];

                handler.ThrowOrIgnore(context, detail);
            }
        }