protected virtual void OnError(ErrorEventArgs e)
 {
     if (Error != null)
     {
         Error(this, e);
     }
 }
Example #2
0
        void controller_UpdatePACFromGFWListError(object sender, System.IO.ErrorEventArgs e)
        {
            GFWListUpdater updater = (GFWListUpdater)sender;

            ShowBalloonTip(I18N.GetString("Failed to update PAC file"), e.GetException().Message, ToolTipIcon.Error, 5000);
            Logging.LogUsefulException(e.GetException());
        }
Example #3
0
 void fsw_Error(object sender, System.IO.ErrorEventArgs e)
 {
     if (LogEvent != null)
     {
         LogEvent(Classes.Enumerations.LoggingEnumerations.LogEventTypes.Information, "File Error " + e.GetException().Message);
     }
 }
Example #4
0
 private void Connection_Error(object sender, System.IO.ErrorEventArgs err)
 {
     lock (errorEvents)
     {
         errorEvents.AddLast(err);
     }
 }
Example #5
0
		private void watcherError(object sender, ErrorEventArgs e)
		{
			try
			{
				((FileSystemWatcher)sender).Dispose();

				FileSystemWatcher copy;

				lock (_sync)
				{
					if (_disposed)
						return;

					if (_watcher != sender)
						return;

					if (_watcher == null)
						return;

					copy = _watcher;
					_watcher = createWatch();
				}

				copy.EnableRaisingEvents = false;
				copy.Dispose();

				_are.Set();
			}
			catch (Exception ex)
			{
				throw new Exception("Error while file checking.", ex);
			}
		}
Example #6
0
 protected void OnNetworkStatusChanged(ErrorEventArgs e)
 {
     ErrorEventHandler handler = NetworkStatus;
     if (handler != null)
     {
         handler(this, e);
     }
 }
 private void OnError(object sender, ErrorEventArgs e)
 {
     // Notify all cache entries on error.
     foreach (var token in _tokenCache.Values)
     {
         ReportChangeForMatchedEntries(token.Pattern);
     }
 }
 private void Watcher_Error(object sender, System.IO.ErrorEventArgs e)
 {
     if (e.GetException().GetType() == typeof(InternalBufferOverflowException))
     {
         _logger.Error($" Watcher InternalBufferOverflowException {e.GetException().ToString()}");
     }
     _logger.Error($" Watcher Error {e.GetException().ToString()}");
 }
Example #9
0
        private void MjpegOnError(object sender, ErrorEventArgs e)
        {
            string message = string.Format(CultureInfo.InvariantCulture, "Cam error: {0}, restarting..", e.Message);
            _mainPage.DisplayStatus(message, MainPage.NotifyType.ErrorMessage);

            Task.Delay(TimeSpan.FromSeconds(1)).Wait();
            MjpegInitialize();
        }
 //连接错误
 void Client_ConnectError(object sender, System.IO.ErrorEventArgs e)
 {
     MessageBox.Show("Connect Err.");
     this.Dispatcher.Invoke(new Action(() =>
     {
         this.Close();                                               //匿名委托,支线程调用主线程函数
     }));
 }
Example #11
0
        private static void OnError(object sender, ErrorEventArgs e)
        {
            var exception = e.GetException();
            Console.Error.WriteLine($"Hit an Exception with HResult '{ exception.HResult }'" +
                Environment.NewLine +
                $"{ exception }");

            Environment.FailFast(exception.Message);
        }
Example #12
0
 private void SubDirectories_LoadingError(object sender, System.IO.ErrorEventArgs e)
 {
     if (_isOpening)
     {
         MessageBoxService.Instance.ShowError(e.GetException().Message);
         Parent.Open();
     }
     _isOpening = false;
 }
Example #13
0
        private static void ValidateErrorEventArgs(Exception exception)
        {
            ErrorEventArgs args = new ErrorEventArgs(exception);

            Assert.Equal(exception, args.GetException());

            // Make sure method is consistent.
            Assert.Equal(exception, args.GetException());
        }
 void OnError(object sender, ErrorEventArgs e)
 {
     // when an error occurs, the current FileSystemWatcher is disposed,
     // and a new one is created
     string lPath = fWatcher.Path;
     string lFilter = fWatcher.Filter;
     fWatcher.Dispose();
     Initialize(lPath, lFilter);
 }
Example #15
0
 private void InvokeHandler(ErrorEventHandler eventHandler, ErrorEventArgs e)
 {
     if (eventHandler != null)
     {
         if (_containedFSW.SynchronizingObject != null && this._containedFSW.SynchronizingObject.InvokeRequired)
         {
             _containedFSW.SynchronizingObject.BeginInvoke(eventHandler, new object[] { this, e });
         }
         else
         {
             eventHandler(this, e);
         }
     }
 }
Example #16
0
 private void OnError(object sender, System.IO.ErrorEventArgs e)
 {
     if (InvokeRequired)
     {
         this.BeginInvoke(new MethodInvoker(delegate()
         {
             ShowErrorMessage(this, e.GetException());
         }));
     }
     else
     {
         ShowErrorMessage(this, e.GetException());
     }
 }
Example #17
0
 private void WatcherError(object UnnamedParameter1, System.IO.ErrorEventArgs UnnamedParameter2)
 {
     while (!this.watcher.EnableRaisingEvents)
     {
         try
         {
             this.StartWatching();
             this.RefreshResumeDat();
         }
         catch
         {
             System.Threading.Thread.Sleep(500);
         }
     }
 }
 /// <summary>
 /// Initializes a new instance of the FileWatcherBufferErrorEventArgs class.
 /// </summary>
 /// <param name="daemonName">Daemon name of the file watcher.</param>
 /// <param name="e">ErrorEventArgs.</param>
 /// <exception cref="ArgumentNullException">e is null.</exception>
 /// <exception cref="ArgumentNullException">daemonName is null.</exception>
 public FileWatcherBufferErrorEventArgs(string daemonName,
     ErrorEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e",
                                         Resources.ArgumentNullException);
     }
     if (daemonName == null)
     {
         throw new ArgumentNullException("daemonName",
                                         Resources.ArgumentNullException);
     }
     _daemonName = daemonName;
     _errorEventArgs = e;
 }
Example #19
0
        void client_Error(object sender, ErrorEventArgs e)
        {
            if (OnError != null)
            {
                OnError(sender, e);
            }

            //Also fire close event if the connection fail to connect
            if (m_StateCode == PSocketStateConst.Connecting)
            {
                m_StateCode = PSocketStateConst.Closing;
                if (Client != null)
                {
                    Client.Close();
                }
            }
        }
        private void BufferingFileSystemWatcher_Error(object sender, ErrorEventArgs e)
        {
            //These exceptions have the same HResult
            var NetworkNameNoLongerAvailable = -2147467259; //occurs on network outage
            var AccessIsDenied = -2147467259;               //occurs after directory was deleted


            var ex = e.GetException();

            if (ExceptionWasHandledByCaller(e.GetException()))
            {
                return;
            }

            //The base FSW does set .EnableRaisingEvents=False AFTER raising OnError()
            EnableRaisingEvents = false;

            if (ex is InternalBufferOverflowException || ex is EventQueueOverflowException)
            {
                _trace.Warn(ex.Message);
                _trace.Error(@"This should Not happen with short event handlers!
                             - Will recover automatically.");
                ReStartIfNeccessary(DirectoryRetryInterval);
            }
            else if (ex is Win32Exception && (ex.HResult == NetworkNameNoLongerAvailable |
                                              ex.HResult == AccessIsDenied))
            {
                _trace.Debug(ex.Message);
                _trace.Debug("Will try to recover automatically!");
                ReStartIfNeccessary(DirectoryRetryInterval);
            }
            else
            {
                _trace.Error($@"Unexpected error: {ex}
                             - Watcher is disabled!");
                throw ex;
            }
        }
Example #21
0
        /// <summary>
        /// Handles the Error event of the watcher control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ErrorEventArgs" /> instance containing the event data.</param>
        void watcher_Error(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();
            var dw = (FileSystemWatcher)sender;

            Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);

            DisposeWatcher(dw);
        }
 /// <summary>
 ///     Callback for <see cref="FileSystemWatcher" /> file error events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnFileError(object sender, ErrorEventArgs e)
 {
     _tailActor.Tell(new TailActor.FileError(_fileNameOnly, e.GetException().Message), ActorRefs.NoSender);
 }
Example #23
0
    //consume messages as they come in
    private void ConsumeNetworkMessages()
    {
        lock (messageEvents)
        {
            while (messageEvents.Count > 0)
            {
                Message m = messageEvents.First.Value;

                foreach (GameObject g in eventListeners)
                {
                    g.SendMessage("NetworkIt_Message", m, SendMessageOptions.DontRequireReceiver);
                }

                messageEvents.RemoveFirst();
            }
        }

        lock (errorEvents)
        {
            while (errorEvents.Count > 0)
            {
                System.IO.ErrorEventArgs err = errorEvents.First.Value;

                foreach (GameObject g in eventListeners)
                {
                    g.SendMessage("NetworkIt_Error", err, SendMessageOptions.DontRequireReceiver);
                }

                errorEvents.RemoveFirst();
            }
        }

        lock (connectEvents)
        {
            while (connectEvents.Count > 0)
            {
                EventArgs args = connectEvents.First.Value;

                foreach (GameObject g in eventListeners)
                {
                    g.SendMessage("NetworkIt_Connect", args, SendMessageOptions.DontRequireReceiver);
                }

                connectEvents.RemoveFirst();
            }
        }

        lock (disconnectEvents)
        {
            while (disconnectEvents.Count > 0)
            {
                EventArgs args = disconnectEvents.First.Value;

                foreach (GameObject g in eventListeners)
                {
                    g.SendMessage("NetworkIt_Disconnect", args, SendMessageOptions.DontRequireReceiver);
                }

                disconnectEvents.RemoveFirst();
            }
        }
    }
Example #24
0
 public void ReportErrors(ErrorEventArgs errorEventArguments) {
   throw new NotImplementedException();
 }
Example #25
0
        /// <summary>
        /// Handles the Error event of the watcher control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ErrorEventArgs" /> instance containing the event data.</param>
        void watcher_Error(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();
            var dw = (FileSystemWatcher)sender;

            Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);

            DisposeWatcher(dw);

            if (ConfigurationManager.Configuration.EnableLibraryMonitor == AutoOnOff.Auto)
            {
                Logger.Info("Disabling realtime monitor to prevent future instability");

                ConfigurationManager.Configuration.EnableLibraryMonitor = AutoOnOff.Disabled;
                Stop();
            }
        }
Example #26
0
 private void BufferingFileSystemWatcher_Error(object sender, ErrorEventArgs e)
 {
     InvokeHandler(_onErrorHandler, e);
 }
 private void OnError(object sender, ErrorEventArgs e)
 {
     // Trigger all the cache entries on error.
     foreach (var trigger in _triggerCache.Values)
     {
         ReportChangeForMatchedEntries(trigger.Pattern);
     }
 }
Example #28
0
 private void ServiceBusListener_OnListenError(object sender, System.IO.ErrorEventArgs e)
 {
     Debug.LogErrorFormat("Error:{0}", e.GetException().Message);
 }
Example #29
0
    private void fsw_Error(Object sender, System.IO.ErrorEventArgs e)
    {
        Exception exp = e.GetException();

        AddItem(exp.Message);
    }
Example #30
0
 void GlobalWebSocket_OnError(object sender, System.IO.ErrorEventArgs e)
 {
 }
Example #31
0
 private static void Dialer_Error(object sender, System.IO.ErrorEventArgs e)
 {
     Log.LogError("Event Dialer_Error: " + e.ToString(), e.GetException());
 }
Example #32
0
 private void OnError(object sender, System.IO.ErrorEventArgs e)
 {
     _logger.InfoException($"File {ConfigFile} occurred errors.", e.GetException());
 }
Example #33
0
 private void OnFileSystemWatcherError(object sender, System.IO.ErrorEventArgs e)
 {
     this.OnError(e.GetException());
 }
Example #34
0
        private void Target_Error(object sender, System.IO.ErrorEventArgs e)
        {
            this.error = e.GetException();

            this.waitHandle.Set();
        }
 private void PackReceived_Error(object sender, ErrorEventArgs e)
 {
     Terminal.Instance.Client.Notifier.Log(TraceLevel.Error, e.GetException().ToString());
 }
 private void pacServer_PACUpdateError(object sender, ErrorEventArgs e)
 {
     if (UpdatePACFromGFWListError != null)
         UpdatePACFromGFWListError(this, e);
 }
Example #37
0
 void controller_Errored(object sender, System.IO.ErrorEventArgs e)
 {
     MessageBox.Show(e.GetException().ToString(), String.Format(I18N.GetString("Shadowsocks Error: {0}"), e.GetException().Message));
 }
Example #38
0
 /// <summary>Raises the <see cref="E:System.IO.FileSystemWatcher.Error" /> event.</summary>
 /// <param name="e">An <see cref="T:System.IO.ErrorEventArgs" /> that contains the event data. </param>
 protected void OnError(ErrorEventArgs e)
 {
     RaiseEvent(this.Error, e, EventType.ErrorEvent);
 }
Example #39
0
 private void Dialer_Error(object sender, System.IO.ErrorEventArgs e)
 {
     this.tMessage.AppendText("连接失败,请检查网络异常!\r\n");
 }
 void controller_UpdatePACFromGeositeError(object sender, System.IO.ErrorEventArgs e)
 {
     ShowBalloonTip(I18N.GetString("Failed to update PAC file"), e.GetException().Message, ToolTipIcon.Error, 5000);
     logger.LogUsefulException(e.GetException());
 }
Example #41
0
        /// <summary>
        /// Handles the Error event of the watcher control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ErrorEventArgs" /> instance containing the event data.</param>
        async void watcher_Error(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();
            var dw = (FileSystemWatcher)sender;

            Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);

            //Network either dropped or, we are coming out of sleep and it hasn't reconnected yet - wait and retry
            var retries = 0;
            var success = false;
            while (!success && retries < 10)
            {
                await Task.Delay(500).ConfigureAwait(false);

                try
                {
                    dw.EnableRaisingEvents = false;
                    dw.EnableRaisingEvents = true;
                    success = true;
                }
                catch (ObjectDisposedException)
                {
                    RemoveWatcherFromList(dw);
                    return;
                }
                catch (IOException)
                {
                    Logger.Warn("Network still unavailable...");
                    retries++;
                }
                catch (ApplicationException)
                {
                    Logger.Warn("Network still unavailable...");
                    retries++;
                }
            }
            if (!success)
            {
                Logger.Warn("Unable to access network. Giving up.");
                DisposeWatcher(dw);
            }
        }
Example #42
0
 internal void DispatchErrorEvents(ErrorEventArgs args)
 {
     OnError(args);
 }
        /// <summary>
        /// Handles the Error event of the <see cref="FileSystemWatcher"/>.
        /// </summary>
        private void OnFileWatcherError(object sender, ErrorEventArgs e)
        {
            // Stop further listening on error.
              if (mFileWatcher != null)
              {
            mFileWatcher.EnableRaisingEvents = false;
            mFileWatcher.Changed            -= OnLogFileChanged;
            mFileWatcher.Error              -= OnFileWatcherError;
            mFileWatcher.Dispose();
              }

              string pathOfFile = Path.GetDirectoryName(mFileToObserve);
              string nameOfFile = Path.GetFileName(mFileToObserve);

              if (!string.IsNullOrEmpty(pathOfFile) && !string.IsNullOrEmpty(nameOfFile))
              {
            mFileWatcher = new FileSystemWatcher(
            pathOfFile
              , nameOfFile);

            mFileWatcher.NotifyFilter        = NotifyFilters.LastWrite | NotifyFilters.Size;
            mFileWatcher.Changed            += OnLogFileChanged;
            mFileWatcher.Error              += OnFileWatcherError;
            mFileWatcher.EnableRaisingEvents = IsActive;

            ReadNewLogMessagesFromFile();
              }
        }
 // destructor shouldn't be used because it's not predictable when
 // it's going to be called by the GC!
 private void WorkTreeWatcherError(object sender, ErrorEventArgs e)
 {
     ScheduleNextRegularUpdate();
 }
Example #45
0
File: KfsScan.cs Project: tmbx/kwm
        /// <summary>
        /// Called when the watcher has failed.
        /// </summary>
        private void HandleOnWatcherError(object sender, ErrorEventArgs e)
        {
            try
            {
                if (Share != null)
                    Share.OnWatcherError(sender, e);
            }

            catch (Exception ex)
            {
                Logging.LogException(ex);
            }
        }
Example #46
0
 private void GameManagerOnOnError(object sender, ErrorEventArgs errorEventArgs)
 {
     MessageBox.Show(errorEventArgs.GetException().ToString(), "Error creating game");
 }
Example #47
0
 /// <summary>Raises the <see cref="E:System.IO.FileSystemWatcher.Error" /> event.</summary>
 /// <param name="e">An <see cref="T:System.IO.ErrorEventArgs" /> that contains the event data. </param>
 protected void OnError(ErrorEventArgs e)
 {
     this.RaiseEvent(this.Error, e, FileSystemWatcher.EventType.ErrorEvent);
 }
 // destructor shouldn't be used because it's not predictable when
 // it's going to be called by the GC!
 private void WorkTreeWatcherError(object sender, ErrorEventArgs e)
 {
     ScheduleDeferredUpdate();
 }
 private void SocketExceptionHandler(object sender, ErrorEventArgs error)
 {
     MessageBox.Show("The connection to the spreadsheet has been lost.\nPlease try to join again.\n\n" + error.GetException().Message, "Connection Lost", MessageBoxButtons.OK, MessageBoxIcon.Error);
     CleanSpreadsheet();
 }
 private void dorg_ErrorOccured(object sender, System.IO.ErrorEventArgs e)
 {
     handleError(e.GetException());
 }
Example #51
0
 /// Callback for errors in watcher
 protected void OnWatcherError(object source, ErrorEventArgs e)
 {
     Console.Error.WriteLine("*** {0}", e.GetException());
 }
Example #52
0
 private static void FileWatcherError(object sender, ErrorEventArgs e)
 {
     Console.WriteLine("File watcher exception: " + e.GetException().Message);
 }
Example #53
0
 private void ViewModel_Error(object sender, ErrorEventArgs e)
 {
     MessageBox.Show(this, e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
 }
Example #54
0
 void onError(object sender, ErrorEventArgs e)
 {
     throw new Exception("{0}: File system watcher error {1}".format(_path, e.GetException().Message));
 }
Example #55
0
 protected void OnError(ErrorEventArgs e)
 {
     _onErrorHandler?.Invoke(this, e);
 }
Example #56
0
 void WatcherError(object sender, ErrorEventArgs e)
 {
     LogMyFilms.Debug("File Watcher: Error event: " + e.GetException().Message);
       refreshWatchers = true;
 }
Example #57
0
 public void OnErr(ErrorEventArgs args)
 {
     Err(this, args);
 }
 private void FS_Error(object sender, System.IO.ErrorEventArgs e)
 {
     OnLog(String.Format("FileSystemWatcher Error {0}", e.GetException().Message));
 }
Example #59
0
		void fsw_Error(object sender, ErrorEventArgs e)
		{
			Exception err = e.GetException();
			// 当检测网络路径时,如果网络断开,则会爆 Code 为 64 的 Win32 异常
			if (err is System.ComponentModel.Win32Exception)
			{
				this.hasWin32Error = true;

				this.win32ErrorTime = DateTime.Now;

				XMS.Core.Container.LogService.Warn(
					String.Format("在监测“{0}”时 发生 Win32 错误,错误码为:{1},详细错误信息为:{2}"
					,this.fileOrDirectory, ((System.ComponentModel.Win32Exception)err).NativeErrorCode, ((System.ComponentModel.Win32Exception)err).Message)
					, Logging.LogCategory.Cache);
			}
			else // 经查看 FileSystemWatcher 的内部实现,基本上不会抛出其它类型的异常
			{
				XMS.Core.Container.LogService.Warn(
					String.Format("在监测“{0}”时 发生错误,详细错误信息为:{1}"
					, this.fileOrDirectory, err.Message)
					, Logging.LogCategory.Cache);
			}
		}
Example #60
0
 private void Helper_errorHandler(object sender, System.IO.ErrorEventArgs e)
 {
     MessageBox.Show("在执行过程中发生错误!\n\n详细信息: \n" + e.GetException().Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
     Close();
 }