protected void ExecuteAndHandleError(string description, ManageDelegationClient.WebMethodDelegate webMethod)
        {
            LocalizedException ex = null;

            try
            {
                this.ExecuteAndRetry(description, webMethod);
            }
            catch (SoapException exception)
            {
                ex = this.GetLiveDomainServicesAccessExceptionToThrow(exception);
            }
            catch (WebException exception2)
            {
                ex = ManageDelegationClient.GetCommunicationException(exception2);
            }
            catch (IOException exception3)
            {
                ex = ManageDelegationClient.GetCommunicationException(exception3);
            }
            catch (SocketException exception4)
            {
                ex = ManageDelegationClient.GetCommunicationException(exception4);
            }
            catch (InvalidOperationException exception5)
            {
                ex = ManageDelegationClient.GetCommunicationException(exception5);
            }
            if (ex != null)
            {
                this.WriteVerbose(Strings.LiveDomainServicesRequestFailed(ManageDelegationClient.GetExceptionDetails(ex)));
                throw ex;
            }
        }
        private static string GetExceptionDetails(Exception exception)
        {
            int           num           = 0;
            StringBuilder stringBuilder = new StringBuilder(10000);

            while (exception != null)
            {
                stringBuilder.AppendFormat("[{0}]: {1}", num.ToString(), exception.GetType().FullName);
                stringBuilder.AppendLine();
                stringBuilder.AppendLine(exception.Message);
                ManageDelegationClient.DetailException(stringBuilder, exception as SoapException);
                ManageDelegationClient.DetailException(stringBuilder, exception as WebException);
                ManageDelegationClient.DetailException(stringBuilder, exception as SocketException);
                if (exception.StackTrace != null)
                {
                    stringBuilder.AppendLine(exception.StackTrace);
                }
                exception = exception.InnerException;
                num++;
                if (exception != null)
                {
                    stringBuilder.AppendLine();
                }
            }
            return(stringBuilder.ToString());
        }