void IReferenceErrorReporter.ValidateReference(string parameter, string rawValue, ValidateReferenceDelegate validateReferenceMethood)
 {
     try
     {
         validateReferenceMethood(new Task.ErrorLoggerDelegate(this.WriteError));
     }
     catch (ManagementObjectNotFoundException innerException)
     {
         ReferenceNotFoundException error = new ReferenceNotFoundException(rawValue, innerException);
         this.AddError(parameter, error);
     }
     catch (ManagementObjectAmbiguousException innerException2)
     {
         ReferenceAmbiguousException error2 = new ReferenceAmbiguousException(rawValue, innerException2);
         this.AddError(parameter, error2);
     }
     catch (BatchReferenceErrorReporter.ValidationException ex)
     {
         LocalizedException        ex2 = ex.InnerException as LocalizedException;
         ReferenceInvalidException error3;
         if (ex2 != null)
         {
             error3 = new ReferenceInvalidException(rawValue, ex2);
         }
         else
         {
             error3 = new ReferenceInvalidException(rawValue, ex.InnerException);
         }
         this.AddError(parameter, error3);
     }
 }
        internal UserPhotoQueryResult(LocalizedException exception, ITracer upstreamTracer) : base(exception)
        {
            this.tracer = ExTraceGlobals.UserPhotosTracer.Compose(upstreamTracer);
            HttpStatusCode httpStatusCode = UserPhotoQueryResult.TranslateExceptionToHttpStatusCode(exception);

            this.tracer.TraceDebug <HttpStatusCode, string>((long)this.GetHashCode(), "Translated exception in query to HTTP {0}.  Exception: {1}", httpStatusCode, (exception != null) ? exception.Message : string.Empty);
            this.StatusCode = httpStatusCode;
            this.Expires    = null;
            HttpStatusCode httpStatusCode2 = httpStatusCode;

            if (httpStatusCode2 <= HttpStatusCode.NotModified)
            {
                if (httpStatusCode2 == HttpStatusCode.OK || httpStatusCode2 == HttpStatusCode.NotModified)
                {
                    return;
                }
            }
            else if (httpStatusCode2 != HttpStatusCode.NotFound && httpStatusCode2 != HttpStatusCode.InternalServerError)
            {
            }
            if (this.FallbackToADPhoto(exception))
            {
                return;
            }
            this.CacheId        = null;
            this.UserPhotoBytes = Array <byte> .Empty;
        }
 public FolderSaveResult(OperationResult operationResult, LocalizedException exception, PropertyError[] propertyErrors)
 {
     EnumValidator.ThrowIfInvalid <OperationResult>(operationResult, "operationResult");
     this.OperationResult = operationResult;
     this.PropertyErrors  = propertyErrors;
     this.Exception       = exception;
 }
Exemple #4
0
        // Token: 0x06000ABC RID: 2748 RVA: 0x000461D8 File Offset: 0x000443D8
        private List <MailboxInfo> GetAllLocalUserMailboxes()
        {
            ExTraceGlobals.MWITracer.TraceDebug <string>((long)this.GetHashCode(), "GetAllLocalUserMailboxes(): Getting user mailboxes for database {0}", base.DatabaseInfo.DisplayName);
            LocalizedException ex   = null;
            List <MailboxInfo> list = new List <MailboxInfo>();

            try
            {
                Hashtable umenabledUsersFromAD = this.GetUMEnabledUsersFromAD();
                ExTraceGlobals.MWITracer.TraceDebug <int>((long)this.GetHashCode(), "GetAllLocalUserMailboxes:GetUMEnabledUsersFromAD returned {0} records.", umenabledUsersFromAD.Count);
                if (umenabledUsersFromAD.Count != 0)
                {
                    using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=EBA", null, null, null, null))
                    {
                        PropValue[][] mailboxTable = exRpcAdmin.GetMailboxTable(base.DatabaseInfo.Guid, new PropTag[]
                        {
                            PropTag.UserGuid,
                            PropTag.DisplayName,
                            PropTag.DateDiscoveredAbsentInDS
                        });
                        ExTraceGlobals.MWITracer.TraceError <string, int>((long)this.GetHashCode(), "GetAllLocalUserMailboxes: Database({0}).GetMailboxTable returned {1} records", base.DatabaseInfo.DisplayName, mailboxTable.Length);
                        foreach (PropValue[] array2 in mailboxTable)
                        {
                            if (array2.Length == 3 && array2[0].PropTag == PropTag.UserGuid && array2[1].PropTag == PropTag.DisplayName && array2[2].PropTag != PropTag.DateDiscoveredAbsentInDS)
                            {
                                Guid guid = new Guid(array2[0].GetBytes());
                                if (base.DatabaseInfo.IsUserMailbox(guid) && umenabledUsersFromAD.Contains(guid))
                                {
                                    MailboxInfo mailboxInfo = new MailboxInfo(guid, array2[1].GetString(), (OrganizationId)umenabledUsersFromAD[guid]);
                                    ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo>((long)this.GetHashCode(), "GetAllLocalUserMailboxes(): Adding {0} to the mailbox list", mailboxInfo);
                                    list.Add(mailboxInfo);
                                }
                            }
                        }
                        goto IL_1CF;
                    }
                }
                ExTraceGlobals.MWITracer.TraceError((long)this.GetHashCode(), "GetAllLocalUserMailboxes:GetUMEnabledUsersFromAD returned 0 records.");
                IL_1CF :;
            }
            catch (MapiPermanentException ex2)
            {
                ex = ex2;
            }
            catch (MapiRetryableException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                ExTraceGlobals.MWITracer.TraceError <string, LocalizedException>((long)this.GetHashCode(), "TryGetMailboxEnumerator: Could not get the list of mailboxes for DB {0}: {1}", base.DatabaseInfo.DisplayName, ex);
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_MwiQueryDatabaseFailed, null, new object[]
                {
                    base.DatabaseInfo.DisplayName,
                    this.syncInterval.TotalMinutes,
                    CommonUtil.ToEventLogString(ex)
                });
            }
            return(list);
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter(new object[]
     {
         this.RootId,
         this.DataObject
     });
     try
     {
         base.WriteVerbose(TaskVerboseStringHelper.GetDeleteObjectVerboseString(this.dataObject.Identity, base.DataSession, typeof(TDataObject)));
         base.DataSession.Delete(this.dataObject);
     }
     catch (DataSourceTransientException exception)
     {
         base.WriteError(exception, ErrorCategory.WriteError, null);
     }
     catch (NullReferenceException innerException)
     {
         LocalizedException exception2 = new LocalizedException(Strings.ExceptionRemoveNoneExistenceObject, innerException);
         base.WriteError(exception2, ErrorCategory.WriteError, null);
     }
     finally
     {
         base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession));
     }
     TaskLogger.LogExit();
 }
Exemple #6
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         List <PropertyInformation> list = null;
         LocalizedException         ex   = null;
         try
         {
             list = RpcGetMonitoringItemHelp.Invoke(this.Server.Fqdn, this.Identity, 900000);
         }
         catch (ActiveMonitoringServerException ex2)
         {
             ex = ex2;
         }
         catch (ActiveMonitoringServerTransientException ex3)
         {
             ex = ex3;
         }
         if (ex != null)
         {
             this.WriteWarning(ex.LocalizedString);
         }
         foreach (PropertyInformation propertyInfo in list)
         {
             MonitorPropertyInformation sendToPipeline = new MonitorPropertyInformation(this.Server.Fqdn, propertyInfo);
             base.WriteObject(sendToPipeline);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
 public static void SetErrorCodeIfNecessary(LocalizedException e, ErrorConstants error)
 {
     if (!(e is AvailabilityException) && !(e is AvailabilityInvalidParameterException))
     {
         e.ErrorCode = (int)error;
     }
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         LocalizedException ex = null;
         try
         {
             RpcSetServerMonitor.Invoke((!string.IsNullOrWhiteSpace(this.Server.Fqdn)) ? this.Server.Fqdn : this.Server.ToString(), this.Name, this.TargetResource, new bool?(this.isRepairing), 30000);
         }
         catch (ActiveMonitoringServerException ex2)
         {
             ex = ex2;
         }
         catch (ActiveMonitoringServerTransientException ex3)
         {
             ex = ex3;
         }
         if (ex != null)
         {
             base.WriteError(ex, ExchangeErrorCategory.ServerOperation, null);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
        private void HandleSqlError(SqlTypeException sqlTypeException)
        {
            ExTraceGlobals.ReportingWebServiceTracer.TraceError <string>(0L, "SqlTypeException. Message: {0}", sqlTypeException.Message);
            LocalizedException localizedException = SqlErrorHandler.TrasnlateError(sqlTypeException);

            this.TaskContext.WriteError(localizedException, ExchangeErrorCategory.ServerOperation, null);
        }
Exemple #10
0
        public static void NotNullAll(Action action, string name, int expectedIndex)
        {
            LocalizedException ex = Assert.Throws <ValueNullException>(
                () => action());

            ex.AssertArguments(StringUtils.Combine(name, "[", expectedIndex.ToString(), "]"));
        }
Exemple #11
0
        // Token: 0x060020E2 RID: 8418 RVA: 0x00097434 File Offset: 0x00095634
        public bool TestStoreConnectivity(TimeSpan timeout, out LocalizedException ex)
        {
            ex = null;
            bool result;

            try
            {
                int verMajor;
                int verMinor;
                base.ProtectedCallWithTimeout("GetAdminVersion", timeout, delegate
                {
                    this.ExRpcAdmin.GetAdminVersion(out verMajor, out verMinor);
                });
                result = true;
            }
            catch (MapiRetryableException ex2)
            {
                ex     = ex2;
                result = false;
            }
            catch (MapiPermanentException ex3)
            {
                ex     = ex3;
                result = false;
            }
            return(result);
        }
Exemple #12
0
        internal static bool ResetUMPin(ADUser aduser, string passwd)
        {
            UmConnectivityCredentialsHelper.DebugTrace("Inside UmConnectivityCredentialsHelper: ResetUMPin", new object[0]);
            string pin;

            try
            {
                UMMailboxPolicy policyFromUser = Utility.GetPolicyFromUser(aduser);
                if (!UmConnectivityCredentialsHelper.GetRandomPINFromPasswd(passwd, policyFromUser.MinPINLength, out pin))
                {
                    UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): didnt get pin", new object[0]);
                    return(false);
                }
            }
            catch (LocalizedException ex)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): got Exception = {0}", new object[]
                {
                    ex.ToString()
                });
                return(false);
            }
            LocalizedException ex2 = UmConnectivityCredentialsHelper.SaveUMPin(aduser, pin);

            if (ex2 != null)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): SaveUMPin Exception = {0}", new object[]
                {
                    ex2.ToString()
                });
                return(false);
            }
            return(true);
        }
 // Token: 0x06000336 RID: 822 RVA: 0x0000CA89 File Offset: 0x0000AC89
 public void VerifyAndThrow(LocalizedException le)
 {
     if (!this.Verify())
     {
         throw le;
     }
 }
Exemple #14
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         this.monitorHealthCommon = new MonitorHealthCommon((!string.IsNullOrWhiteSpace(base.Identity.Fqdn)) ? base.Identity.Fqdn : base.Identity.ToString(), base.HealthSet, base.HaImpactingOnly);
         LocalizedException        ex = null;
         List <MonitorHealthEntry> monitorHealthEntries = this.monitorHealthCommon.GetMonitorHealthEntries(out ex);
         if (ex != null)
         {
             this.WriteWarning(ex.LocalizedString);
         }
         if (monitorHealthEntries != null)
         {
             foreach (MonitorHealthEntry sendToPipeline in monitorHealthEntries)
             {
                 base.WriteObject(sendToPipeline);
             }
         }
     }
     catch (Exception exception)
     {
         base.WriteError(exception, (ErrorCategory)1000, null);
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Exemple #15
0
        internal static LocalizedException TranslateExceptionHandler(Exception e)
        {
            if (e is LocalizedException)
            {
                if (!(e is MapiRetryableException))
                {
                    if (!(e is MapiPermanentException))
                    {
                        goto IL_42;
                    }
                }
                try
                {
                    LocalizedException ex = StorageGlobals.TranslateMapiException(Strings.UnableToCommunicate, (LocalizedException)e, null, null, string.Empty, new object[0]);
                    if (ex != null)
                    {
                        return(ex);
                    }
                }
                catch (ArgumentException)
                {
                }
            }
IL_42:
            return(null);
        }
Exemple #16
0
        public string Build(Uri requestUrl)
        {
            LocalizedException ex     = null;
            string             result = null;

            try
            {
                result = this.InternalBuild(requestUrl);
            }
            catch (ADOperationException ex2)
            {
                ex = ex2;
            }
            catch (ADTransientException ex3)
            {
                ex = ex3;
            }
            catch (DataValidationException ex4)
            {
                ex = ex4;
            }
            catch (DataSourceOperationException ex5)
            {
                ex = ex5;
            }
            if (ex != null)
            {
                this.Tracer.TraceError <LocalizedException>((long)this.GetHashCode(), "[AuthMetadataBuilder.Build] Active Directory operation error occured. Exception: {0}", ex);
                throw new AuthMetadataInternalException(ex.LocalizedString, ex);
            }
            return(result);
        }
Exemple #17
0
        private StructuredErrors ConvertToNestedErrors(Exception exception)
        {
            StructuredErrors structuredErrors = null;

            while (exception != null)
            {
                StructuredError    structuredError = new StructuredError();
                LocalizedException ex = exception as LocalizedException;
                if (ex != null)
                {
                    structuredError.Code = ex.ErrorCode;
                    structuredError.Info = ex.LocalizedString;
                }
                else
                {
                    structuredError.Code = 0;
                    structuredError.Info = exception.ToString();
                }
                Type type = exception.GetType();
                structuredError.Name       = type.FullName;
                structuredError.Guid       = type.GUID.ToString("n");
                structuredError.Message    = exception.Message;
                structuredError.Source     = exception.Source;
                structuredError.TargetSite = exception.TargetSite.Name;
                if (structuredErrors == null)
                {
                    structuredErrors = new StructuredErrors();
                }
                structuredErrors.AddError(structuredError);
                exception = exception.InnerException;
            }
            return(structuredErrors);
        }
Exemple #18
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (!base.HasErrors)
     {
         if (CommonConstants.UseDataCenterCallRouting && this.DataObject.Address.IsIPAddress && this.DataObject.GlobalCallRoutingScheme != UMGlobalCallRoutingScheme.E164)
         {
             base.WriteError(new GatewayAddressRequiresFqdnException(), ErrorCategory.InvalidOperation, this.DataObject);
         }
         LocalizedException ex = NewUMIPGateway.ValidateFQDNInTenantAcceptedDomain(this.DataObject, (IConfigurationSession)base.DataSession);
         if (ex != null)
         {
             base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject);
         }
         string text = this.DataObject.Address.ToString();
         this.CheckAndWriteError(new IPGatewayAlreadyExistsException(text), text);
         LocalizedException ex2 = NewUMIPGateway.ValidateIPAddressFamily(this.DataObject);
         if (ex2 != null)
         {
             base.WriteError(ex2, ErrorCategory.InvalidOperation, this.DataObject);
         }
     }
     TaskLogger.LogExit();
 }
        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;
            }
        }
        public static LocalizedException ValidateE164Entries(ADConfigurationObject dataObject, MultiValuedProperty <string> e164NumberList)
        {
            LocalizedException result = null;

            if (e164NumberList == null || e164NumberList.Count == 0)
            {
                return(null);
            }
            Dictionary <string, int> dictionary = new Dictionary <string, int>(e164NumberList.Count);

            for (int i = 0; i < e164NumberList.Count; i++)
            {
                string text = e164NumberList[i];
                if (!Utils.IsUriValid(text, UMUriType.E164))
                {
                    result = new InvalidUMPilotIdentifierListEntry(text);
                    break;
                }
                if (dictionary.ContainsKey(text))
                {
                    result = new DuplicateE164PilotIdentifierListEntryException(dataObject.Name);
                    break;
                }
                dictionary[text] = 1;
            }
            return(result);
        }
Exemple #21
0
        public static void NotNullAny(Action action, string name)
        {
            LocalizedException ex = Assert.Throws <ValueNullException>(
                () => action());

            ex.AssertArguments(name);
        }
Exemple #22
0
 public static void LogError(Exception e)
 {
     while (e != null)
     {
         LocalizedException ex = e as LocalizedException;
         string             message;
         if (ex != null && TaskLogger.FormatProvider != null)
         {
             IFormatProvider formatProvider = ex.FormatProvider;
             ex.FormatProvider = TaskLogger.FormatProvider;
             message           = ex.Message;
             ex.FormatProvider = formatProvider;
         }
         else
         {
             message = e.Message;
         }
         ExTraceGlobals.ErrorTracer.TraceError <LocalizedString, string, string>(0L, "{0}{1}\n{2}", Strings.LogErrorPrefix, message, e.StackTrace);
         if (TaskLogger.fileLoggingEnabled)
         {
             TaskLogger.LogErrorString(message);
         }
         e = e.InnerException;
     }
 }
Exemple #23
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         LocalizedException ex = null;
         if (!Datacenter.IsMultiTenancyEnabled())
         {
             ex = base.ResetAutomatedCredentialsOnMailboxServer(this.localServer, true);
         }
         if (ex == null)
         {
             base.WriteMonitoringEvent(1000, this.MonitoringEventSource, EventTypeEnumeration.Success, Strings.AllActiveSyncTransactionsSucceeded);
         }
         else if (ex is CasHealthUserNotFoundException)
         {
             base.WriteMonitoringEvent(1008, this.MonitoringEventSource, EventTypeEnumeration.Warning, Strings.InstructResetCredentials(base.ShortErrorMsgFromException(ex)));
         }
         else
         {
             base.WriteMonitoringEvent(1001, this.MonitoringEventSource, EventTypeEnumeration.Error, base.ShortErrorMsgFromException(ex));
         }
     }
     finally
     {
         if (base.MonitoringContext)
         {
             base.WriteMonitoringData();
         }
         TaskLogger.LogExit();
     }
 }
 private void HandleError(LocalizedException localizedException, SetUMConnectivityTestCredentials.EventId id, string eventSource)
 {
     this.WriteErrorAndMonitoringEvent(localizedException, ErrorCategory.NotSpecified, null, (int)id, eventSource);
     if (this.MonitoringContext)
     {
         base.WriteObject(this.monitoringData);
     }
 }
 private void CheckAndWriteError(LocalizedException ex, string addr)
 {
     UMIPGateway[] array = Utility.FindGatewayByIPAddress(addr, this.ConfigurationSession);
     if (array != null && array.Length > 0)
     {
         base.WriteError(ex, ErrorCategory.InvalidOperation, null);
     }
 }
Exemple #26
0
 private void CheckAndWriteError(LocalizedException ex, string addr)
 {
     UMIPGateway[] array = Utility.FindGatewayByIPAddress(addr, this.ConfigurationSession);
     if (array != null && array.Length > 0 && (array.Length != 1 || !array[0].Guid.Equals(this.DataObject.Guid)))
     {
         base.WriteError(ex, ErrorCategory.InvalidData, null);
     }
 }
        private bool TrySyncOneItem(MailboxSession mailboxSession, ItemSynchronizer itemSynchronizer, ItemType remoteItem)
        {
            SharingEngine.Tracer.TraceDebug <SharingEngine, string>((long)this.GetHashCode(), "{0}: Syncing item {1}", this, remoteItem.ItemId.Id);
            LocalizedException exception = null;

            try
            {
                Exception syncException = null;
                GrayException.MapAndReportGrayExceptions(delegate()
                {
                    try
                    {
                        itemSynchronizer.Sync(remoteItem, mailboxSession, this.ExchangeService);
                    }
                    catch (FailedCommunicationException syncException)
                    {
                        FailedCommunicationException syncException = syncException;
                    }
                    catch (StorageTransientException syncException2)
                    {
                        FailedCommunicationException syncException = syncException2;
                    }
                    catch (ObjectNotFoundException syncException3)
                    {
                        FailedCommunicationException syncException = syncException3;
                    }
                    catch (RecurrenceException exception2)
                    {
                        exception = exception2;
                    }
                    catch (TimeZoneException exception3)
                    {
                        exception = exception3;
                    }
                    catch (ObjectValidationException syncException4)
                    {
                        FailedCommunicationException syncException = syncException4;
                    }
                });
                if (syncException != null)
                {
                    SharingEngine.Tracer.TraceError <SharingEngine, Exception>((long)this.GetHashCode(), "{0}: Transient failure while syncing an item. Exception: {1}", this, syncException);
                    throw new BatchSynchronizationFailedException(syncException);
                }
            }
            catch (GrayException exception)
            {
                GrayException exception4;
                exception = exception4;
            }
            if (exception != null)
            {
                SharingEngine.Tracer.TraceError <SharingEngine, string, LocalizedException>((long)this.GetHashCode(), "{0}: Error syncing item {1}. Exception: {2}", this, remoteItem.ItemId.Id, exception);
                SharingLog.LogEntry(mailboxSession, string.Format("Error syncing item - Subject: {0}, Id: {1}, Exception: {2}", remoteItem.Subject, remoteItem.ItemId.Id, exception));
                return(false);
            }
            return(true);
        }
Exemple #28
0
 private void HandleException(LocalizedException e)
 {
     if (!this.MonitoringContext)
     {
         this.WriteError(e, ErrorCategory.OperationStopped, this, true);
         return;
     }
     this.monitoringData.Events.Add(new MonitoringEvent(TestMonitoringServiceBasicCmdletTask.CmdletMonitoringEventSource, 3006, EventTypeEnumeration.Error, e.ToString()));
 }
        private void SaveThePin(UmConnectivityCredentialsHelper help)
        {
            LocalizedException ex = UmConnectivityCredentialsHelper.SaveUMPin(help.User, help.UMPin);

            if (ex != null)
            {
                this.HandleError(ex, SetUMConnectivityTestCredentials.EventId.SavePinFailure, "MSExchange Monitoring UMConnectivityTestCredentials");
            }
        }
		internal virtual void WriteErrorPerObject(LocalizedException exception, ExchangeErrorCategory category, object target)
		{
			if (target == null)
			{
				this.WriteError(exception, category, this.CurrentProcessedObject, false);
				return;
			}
			base.WriteError(exception, category, target);
		}