private TrackingError GetTrackingErrorForAvailabilityException(AvailabilityException ex) { if (ex.InnerException != null) { WebException ex2 = ex.InnerException as WebException; if (ex2 != null) { return(this.GetTrackingErrorForWebException(ex2, true)); } if (ex.InnerException is SoapException) { return(new TrackingError(ErrorCode.UnexpectedErrorTransient, this.TargetInfoForDisplay, string.Format("SoapException when connecting to {0}", this.TargetInfoForDisplay), ex.ToString())); } } if (ex.ErrorCode == 5042 || ex.ErrorCode == 5027) { return(new TrackingError(ErrorCode.UnexpectedErrorTransient, this.TargetInfoForDisplay, string.Format("Client disconnected by {0}", this.TargetInfoForDisplay), ex.ToString())); } if (ex.ErrorCode == 5025) { return(new TrackingError(ErrorCode.CrossForestAuthentication, this.TargetInfoForDisplay, string.Empty, ex.ToString())); } if (this.trackingAuthority.TrackingAuthorityKind == TrackingAuthorityKind.RemoteForest) { return(new TrackingError(ErrorCode.CrossForestMisconfiguration, this.TargetInfoForDisplay, string.Empty, ex.ToString())); } if (this.trackingAuthority.TrackingAuthorityKind == TrackingAuthorityKind.RemoteTrustedOrg) { return(new TrackingError(ErrorCode.CrossPremiseMisconfiguration, this.TargetInfoForDisplay, string.Empty, ex.ToString())); } return(new TrackingError(ErrorCode.UnexpectedErrorTransient, this.TargetInfoForDisplay, string.Format("AvailabilityErrorCode: {0} connecting to {1}", ex.ErrorCode, this.TargetInfoForDisplay), ex.ToString())); }
/// <summary> /// Get a proper <see cref="HttpStatusCode"/> based on exception's details /// </summary> /// <param name="e">An exception</param> /// <returns>A status code</returns> private HttpStatusCode TranslateException(AvailabilityException e) { if (CodeToStatusCodeMap.TryGetValue(e.Detail, out var code)) { return(code); } return(HttpStatusCode.InternalServerError); }