コード例 #1
0
            internal ReservationFailureRec(ResourceReservationException ex)
            {
                this.Reason = ex.GetType().Name;
                StaticCapacityExceededReservationException ex2 = ex as StaticCapacityExceededReservationException;

                if (ex2 != null)
                {
                    this.Name = ex2.ResourceName;
                    this.Type = ex2.ResourceType;
                }
                WlmCapacityExceededReservationException ex3 = ex as WlmCapacityExceededReservationException;

                if (ex3 != null)
                {
                    this.Name                   = ex3.ResourceName;
                    this.Type                   = ex3.ResourceType;
                    this.WLMResourceKey         = ex3.WlmResourceKey;
                    this.WLMResourceMonitorType = ex3.WlmResourceMetricType;
                }
                WlmResourceUnhealthyException ex4 = ex as WlmResourceUnhealthyException;

                if (ex4 != null)
                {
                    this.Name                   = ex4.ResourceName;
                    this.Type                   = ex4.ResourceType;
                    this.WLMResourceKey         = ex4.WlmResourceKey;
                    this.WLMResourceMonitorType = ex4.WlmResourceMetricType;
                }
            }
コード例 #2
0
        private Exception Reconstruct(VersionInformation serverVersion)
        {
            LocalizedException ex             = null;
            Exception          innerException = (this.InnerException != null) ? this.InnerException.Reconstruct(serverVersion) : null;

            if (this.MrsErrorType == MailboxReplicationServiceFault.MRSErrorType.ProxyThrottlingLimitReached)
            {
                ex = new MRSProxyConnectionLimitReachedTransientException(this.Message, innerException);
            }
            else
            {
                WellKnownException ex2 = this.MatchWellKnownException(new WellKnownException[]
                {
                    WellKnownException.StaticCapacityExceededReservation,
                    WellKnownException.WlmCapacityExceededReservation,
                    WellKnownException.WlmResourceUnhealthy
                });
                if (ex2 != WellKnownException.None)
                {
                    switch (ex2)
                    {
                    case WellKnownException.StaticCapacityExceededReservation:
                        ex = new StaticCapacityExceededReservationException(this.ResourceName, this.ResourceType, this.Capacity);
                        break;

                    case WellKnownException.WlmCapacityExceededReservation:
                        ex = new WlmCapacityExceededReservationException(this.ResourceName, this.ResourceType, this.WlmResourceKey, this.WlmResourceMetricType, this.Capacity);
                        break;

                    case WellKnownException.WlmResourceUnhealthy:
                        ex = new WlmResourceUnhealthyException(this.ResourceName, this.ResourceType, this.WlmResourceKey, this.WlmResourceMetricType, this.LoadRatio, this.LoadState, this.LoadMetric);
                        break;
                    }
                }
                if (ex == null)
                {
                    if (this.MrsErrorType == MailboxReplicationServiceFault.MRSErrorType.Transient)
                    {
                        ex = new RemoteTransientException(this.Message, innerException);
                    }
                    else
                    {
                        ex = new RemotePermanentException(this.Message, innerException);
                    }
                }
            }
            IMRSRemoteException ex3 = ex as IMRSRemoteException;

            if (ex3 != null)
            {
                ex3.OriginalFailureType = this.ExceptionType;
                ex3.MapiLowLevelError   = this.MapiLowLevelError;
                ex3.RemoteStackTrace    = this.StackTrace;
                if (this.WKEClasses != null)
                {
                    ex3.WKEClasses = new WellKnownException[this.WKEClasses.Length + 1];
                    for (int i = 0; i < this.WKEClasses.Length; i++)
                    {
                        ex3.WKEClasses[i] = (WellKnownException)this.WKEClasses[i];
                    }
                    ex3.WKEClasses[this.WKEClasses.Length] = WellKnownException.MRSRemote;
                }
                else
                {
                    ex3.WKEClasses = CommonUtils.ClassifyException(ex);
                }
                if (serverVersion != null && !serverVersion[17])
                {
                    if (!CommonUtils.ExceptionIs(ex, new WellKnownException[]
                    {
                        WellKnownException.MRSMailboxIsLocked
                    }) && (MailboxReplicationServiceFault.DownlevelMailboxIsLockedFailureTypes.Contains(ex3.OriginalFailureType) || this.Message.StringId == MrsStrings.DestMailboxAlreadyBeingMoved.StringId || this.Message.StringId == MrsStrings.SourceMailboxAlreadyBeingMoved.StringId))
                    {
                        ex3.WKEClasses = new List <WellKnownException>(ex3.WKEClasses)
                        {
                            WellKnownException.MRSMailboxIsLocked
                        }.ToArray();
                    }
                    if (!CommonUtils.ExceptionIs(ex, new WellKnownException[]
                    {
                        WellKnownException.MapiNotFound
                    }) && ex3.OriginalFailureType == "MapiExceptionNotFound")
                    {
                        ex3.WKEClasses = new List <WellKnownException>(ex3.WKEClasses)
                        {
                            WellKnownException.MapiNotFound
                        }.ToArray();
                    }
                }
            }
            ex.ErrorCode = this.ErrorCode;
            return(ex);
        }
コード例 #3
0
        private static MailboxReplicationServiceFault Create(Exception ex)
        {
            if (ex == null)
            {
                return(null);
            }
            MailboxReplicationServiceFault mailboxReplicationServiceFault = new MailboxReplicationServiceFault();

            if (ex is LocalizedException)
            {
                mailboxReplicationServiceFault.MessageData = CommonUtils.ByteSerialize(((LocalizedException)ex).LocalizedString);
            }
            else
            {
                mailboxReplicationServiceFault.MessageData = CommonUtils.ByteSerialize(new LocalizedString(ex.Message));
            }
            mailboxReplicationServiceFault.Side              = (ExecutionContext.GetExceptionSide(ex) ?? ExceptionSide.None);
            mailboxReplicationServiceFault.ExceptionType     = CommonUtils.GetFailureType(ex);
            mailboxReplicationServiceFault.StackTrace        = ex.StackTrace;
            mailboxReplicationServiceFault.DataContextData   = CommonUtils.ByteSerialize(new LocalizedString(ExecutionContext.GetDataContext(ex)));
            mailboxReplicationServiceFault.ErrorCode         = CommonUtils.HrFromException(ex);
            mailboxReplicationServiceFault.MapiLowLevelError = CommonUtils.GetMapiLowLevelError(ex);
            mailboxReplicationServiceFault.MrsErrorType      = MailboxReplicationServiceFault.ClassifyException(ex);
            WellKnownException[] array = CommonUtils.ClassifyException(ex);
            mailboxReplicationServiceFault.WKEClasses = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                mailboxReplicationServiceFault.WKEClasses[i] = (int)array[i];
            }
            StaticCapacityExceededReservationException ex2 = ex as StaticCapacityExceededReservationException;

            if (ex2 != null)
            {
                mailboxReplicationServiceFault.ResourceName = ex2.ResourceName;
                mailboxReplicationServiceFault.ResourceType = ex2.ResourceType;
                mailboxReplicationServiceFault.Capacity     = ex2.Capacity;
            }
            WlmCapacityExceededReservationException ex3 = ex as WlmCapacityExceededReservationException;

            if (ex3 != null)
            {
                mailboxReplicationServiceFault.ResourceName          = ex3.ResourceName;
                mailboxReplicationServiceFault.ResourceType          = ex3.ResourceType;
                mailboxReplicationServiceFault.WlmResourceKey        = ex3.WlmResourceKey;
                mailboxReplicationServiceFault.WlmResourceMetricType = ex3.WlmResourceMetricType;
                mailboxReplicationServiceFault.Capacity = ex3.Capacity;
            }
            WlmResourceUnhealthyException ex4 = ex as WlmResourceUnhealthyException;

            if (ex4 != null)
            {
                mailboxReplicationServiceFault.ResourceName          = ex4.ResourceName;
                mailboxReplicationServiceFault.ResourceType          = ex4.ResourceType;
                mailboxReplicationServiceFault.WlmResourceKey        = ex4.WlmResourceKey;
                mailboxReplicationServiceFault.WlmResourceMetricType = ex4.WlmResourceMetricType;
                mailboxReplicationServiceFault.LoadRatio             = ex4.ReportedLoadRatio;
                mailboxReplicationServiceFault.LoadState             = ex4.ReportedLoadState;
                mailboxReplicationServiceFault.LoadMetric            = ex4.Metric;
            }
            mailboxReplicationServiceFault.InnerException = MailboxReplicationServiceFault.Create(ex.InnerException);
            return(mailboxReplicationServiceFault);
        }