private static Exception FaultInjectionCallback(string exceptionType)
        {
            LocalizedString localizedString = new LocalizedString("Fault injection.");

            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.StoragePermanentException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StoragePermanentException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.StorageTransientException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StorageTransientException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionSessionLimit", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException = MapiExceptionHelper.SessionLimitException(localizedString);
                return(new TooManyObjectsOpenedException(localizedString, innerException));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionUnconfigured", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException2 = MapiExceptionHelper.UnconfiguredException(localizedString);
                return(new MailboxUnavailableException(localizedString, innerException2));
            }
            if (exceptionType.Equals("CannotGetSiteInfoException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StoragePermanentException(localizedString, new CannotGetSiteInfoException(localizedString)));
            }
            if (exceptionType.Equals("System.ArgumentException", StringComparison.OrdinalIgnoreCase))
            {
                return(new ArgumentException(localizedString));
            }
            if (exceptionType.StartsWith("Microsoft.Mapi.MapiException", StringComparison.OrdinalIgnoreCase))
            {
                return(FaultInjectionHelper.CreateXsoExceptionFromMapiException(exceptionType, localizedString));
            }
            return(new ApplicationException(localizedString));
        }
Пример #2
0
        private static Exception FaultInjectionCallback(string exceptionType)
        {
            LocalizedString localizedString = new LocalizedString("Fault injection.");

            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.MailboxRules.InvalidRuleException", StringComparison.OrdinalIgnoreCase))
            {
                return(new InvalidRuleException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.StoragePermanentException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StoragePermanentException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.StorageTransientException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StorageTransientException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionSessionLimit", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException = MapiExceptionHelper.SessionLimitException(localizedString);
                return(new TooManyObjectsOpenedException(localizedString, innerException));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionRpcServerTooBusy", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException2 = MapiExceptionHelper.RpcServerTooBusyException(localizedString);
                return(new StorageTransientException(localizedString, innerException2));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionNotEnoughMemory", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException3 = MapiExceptionHelper.NotEnoughMemoryException(localizedString);
                return(new StorageTransientException(localizedString, innerException3));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionMaxThreadsPerMdbExceeded", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException4 = MapiExceptionHelper.MaxThreadsPerMdbExceededException(localizedString);
                return(new StorageTransientException(localizedString, innerException4));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionMaxThreadsPerSCTExceeded", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException5 = MapiExceptionHelper.MaxThreadsPerSCTExceededException(localizedString);
                return(new StorageTransientException(localizedString, innerException5));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionUnconfigured", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException6 = MapiExceptionHelper.UnconfiguredException(localizedString);
                return(new MailboxUnavailableException(localizedString, innerException6));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionUnknownUser", StringComparison.OrdinalIgnoreCase))
            {
                Exception innerException7 = MapiExceptionHelper.UnknownUserException(localizedString);
                return(new StoragePermanentException(localizedString, innerException7));
            }
            if (exceptionType.Equals("CannotGetSiteInfoException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StoragePermanentException(localizedString, new CannotGetSiteInfoException(localizedString)));
            }
            if (exceptionType.Equals("System.ArgumentException", StringComparison.OrdinalIgnoreCase))
            {
                return(new ArgumentException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Exchange.Data.Directory.ADTransientException", StringComparison.OrdinalIgnoreCase))
            {
                return(new ADTransientException(localizedString));
            }
            if (exceptionType.Equals("StoreDriverAgentTransientException", StringComparison.OrdinalIgnoreCase))
            {
                return(new StoreDriverAgentTransientException(Strings.StoreDriverAgentTransientExceptionEmail));
            }
            if (exceptionType.Equals("UnexpectedMessageCountException", StringComparison.OrdinalIgnoreCase))
            {
                return(new UnexpectedMessageCountException("Fault injection."));
            }
            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.MailboxInSiteFailoverException", StringComparison.OrdinalIgnoreCase))
            {
                return(new MailboxInSiteFailoverException(localizedString));
            }
            if (exceptionType.Equals("Microsoft.Mapi.MapiExceptionDuplicateDelivery", StringComparison.OrdinalIgnoreCase))
            {
                return(new StoragePermanentException(localizedString, new MapiExceptionDuplicateDelivery(localizedString, 0, 0, null, null)));
            }
            if (exceptionType.Equals("Microsoft.Exchange.MailboxTransport.StoreDriverCommon.SmtpResponseException", StringComparison.OrdinalIgnoreCase))
            {
                return(new SmtpResponseException(AckReason.ApprovalUpdateSuccess, "TestSource"));
            }
            if (exceptionType.Equals("Microsoft.Exchange.Data.Storage.MailboxInfoStaleException", StringComparison.OrdinalIgnoreCase))
            {
                return(new MailboxInfoStaleException(localizedString, new DatabaseNotFoundException(localizedString)));
            }
            if (exceptionType.StartsWith("Microsoft.Mapi.MapiException", StringComparison.OrdinalIgnoreCase))
            {
                return(FaultInjectionHelper.CreateXsoExceptionFromMapiException(exceptionType, localizedString));
            }
            return(new ApplicationException(localizedString));
        }