Exemple #1
0
 static void CallEventHandler(object obj)
 {
     try
     {
         EventObject evtObj = (EventObject)obj;
         evtObj.Execute();
     }
     catch (Exception ex)
     {
         logger.HandleException(ex, "XmlSerializerSectionHandler");
     }
 }
Exemple #2
0
 public static void HandleException(Exception ex, string msg, string sectionName)
 {
     //this sucks, but we need to prevent recursive calling for creating ErrorTrackerConfig
     if (sectionName != "ErrorTrackerConfig")
     {
         logger.HandleException(new ConfigurationErrorsException(msg, ex), "ConfigurationManager");
     }
     else
     {
         logger.Info("ConfigurationManager", new ConfigurationErrorsException(msg, ex));
     }
 }
Exemple #3
0
        private void scareCrow_Changed(object sender, FileSystemEventArgs e)
        {
            try
            {
                string fileName = e.Name.ToLower();
                using (fileLoadResourceLock.WaitToWrite())
                {
                    if (pendingFileReloads.Contains(fileName) || !ContainsFile(fileName))
                    {
                        return;
                    }

                    pendingFileReloads.Add(fileName);
                }

                CountdownTimer timer = new CountdownTimer();
                timer.BeginCountdown(CHANGE_FILE_DELAY, DelayedProcessFileChanged, fileName);
            }
            catch (Exception ex)
            {
                logger.HandleException(ex, "FileWatcher");
            }
        }
Exemple #4
0
 public static void HandleExceptionResponse(string response, string formatedMessage)
 {
     if (response != null)
     {
         if (response.IndexOf("IndexMissingException") > -1)
         {
             throw new IndexMissingException(formatedMessage);
         }
         if (response.IndexOf("TypeMissingException") > -1)
         {
             throw new TypeMissingException(formatedMessage);
         }
         if (response.IndexOf("SearchPhaseExecutionException") > -1)
         {
             throw new SearchPhaseExecutionException(formatedMessage);
         }
         _logger.HandleException(new ElasticSearchException(formatedMessage), "ElasticSearchException");
     }
     _logger.InfoFormat("{0}\r\n{1}", response, formatedMessage);
 }
Exemple #5
0
        void OnConfigFileChanged(object sender, EventArgs args)
        {
            try
            {
                string filePath    = ((FileChangedEventArgs)args).FileName;
                string sectionName = GetSectionName(filePath);

                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);
                int major, minor;
                XmlSerializerSectionHandler.GetConfigVersion(doc.DocumentElement, out major, out minor);

                ConfigEntry entry = GetEntry(sectionName);
                if (entry != null)
                {
                    entry.MinorVersion = minor;
                }
            }
            catch (Exception ex)
            {
                logger.HandleException(ex, "RemoteConfigurationManager");
            }
        }