protected override void HandleException(Exception exception) { if (ProxyWebRequest.ProxyWebRequestTracer.IsTraceEnabled(TraceType.ErrorTrace)) { ProxyWebRequest.ProxyWebRequestTracer.TraceError <object, Exception, ProxyAuthenticator>((long)this.GetHashCode(), "{0}: Exception occurred while completing proxy web request. Exception info is {1}. Caller SIDs: {2}", TraceContext.Get(), exception, this.proxyAuthenticator); } if (this.requestType == RequestType.CrossForest || this.requestType == RequestType.FederatedCrossForest) { Exception ex = exception; if (exception is GrayException) { ex = exception.InnerException; } if (ex is UriFormatException) { RemoteServiceUriCache.Invalidate(this.url); } if (HttpWebRequestExceptionHandler.IsConnectionException(ex, ProxyWebRequest.ProxyWebRequestTracer)) { RemoteServiceUriCache.Invalidate(this.url); } } ProxyWebRequestProcessingException ex2 = this.GenerateException(exception); this.SetExceptionInResultList(ex2); Globals.AvailabilityLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_ProxyWebRequestFailed, this.url, new object[] { Globals.ProcessId, this, this.proxyAuthenticator, ex2 }); this.failedCounter.Increment(); }
private ResponseMessageType[] ExecuteWebMethod(Func<BaseResponseMessageType> webMethodDelegate) { ExchangeService.Tracer.TraceDebug<ExchangeService, string>((long)this.GetHashCode(), "{0}: calling {1}", this, webMethodDelegate.Method.Name); BaseResponseMessageType response = null; int num = 0; for (;;) { Exception exception = null; try { GrayException.MapAndReportGrayExceptions(delegate() { ExchangeService.Tracer.TraceDebug<string>((long)this.GetHashCode(), "Calling {0}", webMethodDelegate.Method.Name); try { response = webMethodDelegate(); } catch (SoapException exception) { SoapException exception = exception; } catch (WebException exception2) { SoapException exception = exception2; } catch (IOException exception3) { SoapException exception = exception3; } catch (InvalidOperationException exception4) { SoapException exception = exception4; } }); } catch (GrayException ex) { ExchangeService.Tracer.TraceError<ExchangeService, string, GrayException>((long)this.GetHashCode(), "{0}: Failed request {1} with gray exception {2}", this, webMethodDelegate.Method.Name, ex); throw new UnexpectedRemoteDataException(ex); } if (exception == null) { goto IL_10A; } ExchangeService.Tracer.TraceError<ExchangeService, string, Exception>((long)this.GetHashCode(), "{0}: failed request {1} with exception {2}", this, webMethodDelegate.Method.Name, exception); if (num >= 3 || HttpWebRequestExceptionHandler.IsConnectionException(exception, ExchangeService.Tracer)) { break; } num++; } throw new FailedCommunicationException(CS$<>8__locals2.exception); IL_10A: if (response == null || response.ResponseMessages == null || response.ResponseMessages.Items == null || response.ResponseMessages.Items.Length == 0) { ExchangeService.Tracer.TraceError<ExchangeService, string>((long)this.GetHashCode(), "{0}: received empty response from request {1}", this, webMethodDelegate.Method.Name); throw new UnexpectedRemoteDataException(); } return response.ResponseMessages.Items; }
protected override void HandleException(Exception exception) { if (GetFolderRequest.GetFolderRequestTracer.IsTraceEnabled(TraceType.ErrorTrace)) { GetFolderRequest.GetFolderRequestTracer.TraceError <object, Exception>((long)this.GetHashCode(), "{0}: Exception occurred while completing GetFolder web request. Exception info is {1}. ", TraceContext.Get(), exception); } GetFolderRequestProcessingException exception2 = this.GenerateException(HttpWebRequestExceptionHandler.TranslateExceptionString(exception)); BaseQueryResult baseQueryResult = base.Application.CreateQueryResult(exception2); if (this.query.SetResultOnFirstCall(baseQueryResult)) { GetFolderRequest.GetFolderRequestTracer.TraceError <object, EmailAddress, BaseQueryResult>((long)this.GetHashCode(), "{0}: the following result was set for query {1}: {2}", TraceContext.Get(), this.query.Email, baseQueryResult); } }