예제 #1
0
        public void ErrorEventArgs_ctor_Null()
        {
            ErrorEventArgs args = new ErrorEventArgs(null);

            Assert.Null(args.GetException());

            // Make sure method is consistent.
            Assert.Null(args.GetException());
        }
예제 #2
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());
    }
예제 #3
0
        public void ErrorEventArgs_ctor()
        {
            Exception exception = new Exception();

            ErrorEventArgs args = new ErrorEventArgs(exception);

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

            // Make sure method is consistent.
            Assert.Equal(exception, args.GetException());
        }
예제 #4
0
        private void OnError(object sender, ErrorEventArgs e)
        {
            // Looking at the log, we observe a burst of OnErrors in short timeframe such as ...
            // System.ComponentModel.Win32Exception (0x80004005): The semaphore timeout period has expired
            // System.ComponentModel.Win32Exception (0x80004005): The specified network name is no longer available
            // System.IO.InternalBufferOverflowException: Too many changes at once in directory: ...
            // Many are due to storage issues - the later happened during deployment.
            // This is to avoid queue multiple work items queueing.
            if (Interlocked.Exchange(ref _pendingOnError, 1) == 1)
            {
                return;
            }

            // Error event is raised when the directory being watched gets deleted
            // in cases when a parent to that directory is deleted, this handler should
            // finish quickly so the deletion does not fail.
            HostingEnvironment.QueueBackgroundWorkItem(cancellationToken =>
            {
                try
                {
                    Exception ex = e.GetException();

                    _analytics.UnexpectedException(ex, trace: false);

                    _traceFactory.GetTracer().TraceError(ex.ToString());
                    ResetWatcher();
                }
                finally
                {
                    Interlocked.Exchange(ref _pendingOnError, 0);
                }
            });
        }
 private void NotifyError(ErrorEventArgs eventArgs)
 {
     Clients.Caller.NotifyError(new
     {
         Exception = eventArgs.GetException().ToString()
     });
 }
예제 #6
0
 private void OnFileError(object sender, ErrorEventArgs e)
 {
     _tailActor.Tell(
         new TailActor.FileError(_fileNameOnly,
                                 e.GetException().Message),
         ActorRefs.NoSender);
 }
예제 #7
0
        /// <summary>
        /// Get file system error event notification message formatted
        /// </summary>
        /// <param name="e">Error event arguments</param>
        /// <returns></returns>
        private string GetFileSystemNotificationMessageFormatted(ErrorEventArgs e)
        {
            // Populate Notification Message
            string strMessage = "Exception: " + e.GetException().ToString();

            return(strMessage);
        }
        private void cd_Failed(object sender, ErrorEventArgs e)
        {
            if (FlagStop)
            {
                return;
            }
            var ex = e.GetException();

            if (ex is ReturnedContentSizeWrongException)
            {
                if (Ranges.Count == 2)
                {
                    foreach (var cd in cdList)
                    {
                        Info.AcceptRanges    = false;
                        cd.Info.AcceptRanges = false;
                        cd.UseChunk          = false;
                    }
                    Ranges.RemoveAt(1);
                    Ranges[0].End = Info.ContentSize - 1;
                    foreach (var item in cdList.Where(x => x.Wait))
                    {
                        item.Wait = false;
                    }
                    return;
                }
            }
            ErrorOccured.Raise(sender, e, aop);
        }
예제 #9
0
        private void OnFileWatcherError(object sender, ErrorEventArgs e)
        {
            mutex.WaitOne();
            Exception ex = e.GetException();
            WatcherFailedEventArgs failedArg = new WatcherFailedEventArgs();

            WatchingDirectoryRemoved?.Invoke(this, failedArg);
            mutex.Set();
            if (failedArg.Action == WatcherFailedAction.Dispose)
            {
                Dispose();
            }
            else
            {
                if (fileWatcher != null)
                {
                    fileWatcher.Dispose();
                }
                if (directoryWatcher != null)
                {
                    directoryWatcher.Dispose();
                }
                WatchingDirectory = failedArg.DirectoryIfResume;
                InitWatcher();
            }
        }
예제 #10
0
        private void FileWatcherError(object sender, ErrorEventArgs e)
        {
            Exception ex = e.GetException();

            UserLog.WriteLine(DateTime.Now + ": LocalPlaylists.FileWatcherError (" + ex + ") - file system changes will not be detected");
            Trace.WriteLine(Trace.kKinsky, ex);
        }
예제 #11
0
        void _ofacOkFileWatcher_Error(object source, ErrorEventArgs e)
        {
            Exception watchException = e.GetException();

            LogUtil.logInfo("Error when watching filewatcher for ofacOk folder:" + config.ofacOkFolder, watchException);
            initOk();
        }
예제 #12
0
        void inputFileWatcher_Error(object source, ErrorEventArgs e)
        {
            Exception watchException = e.GetException();

            LogUtil.logInfo("Error when watching filewatcher for input folder:" + config.inputFolder, watchException);
            initInput();
        }
예제 #13
0
        private void _Error(object sender, ErrorEventArgs e)
        {
            var fswe = sender as FileSystemWatcher;

            //_log.Error("In "+ fswe.Path+" an error has occured",e.GetException());
            _log.Debug("In " + fswe.Path + " an error has occured", e.GetException());
        }
예제 #14
0
        private void OnFileWatcherError(ErrorEventArgs e)
        {
            var folder = _fileWatcher != null ? _fileWatcher.Path : "UNKNOWN";

            _logger.LogException(e.GetException(), "There was an error watching the folder {0}.", folder);
            _fileWatcherError = e;
        }
예제 #15
0
        private void Instance_OnError(object sender, ErrorEventArgs args)
        {
            Exception exception = args.GetException();

            lastException = exception;
            webBrowser.Navigate(DashboardManager.Instance.HtmlErrorFilePath);
        }
예제 #16
0
        }//private void ProcessFileWatcher(object sender, FileSystemEventArgs e)

        /// <summary>
        /// the watcher error to log the error for now
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void WatcherError(object source, ErrorEventArgs e)
        {
            Exception ex = e.GetException();
            // let's log the error for now to see what is going on
            WriteToLogFile("OmcCiberHandler::WatcherError():ExceptionCaught:" + ex.ToString());

        }
예제 #17
0
        protected void OnFileWatcherError(ErrorEventArgs args)
        {
            if (Interlocked.CompareExchange(ref _recovering, 1, 0) != 0)
            {
                return;
            }

            string errorMessage = args.GetException()?.Message ?? "Unknown";

            _logger.AutoRecoveringFileSystemWatcherFailureDetected(errorMessage, _path);

            Recover().ContinueWith(t =>
            {
                if (t.IsFaulted || t.IsCanceled)
                {
                    t.Exception?.Handle(e => true);
                    _logger.AutoRecoveringFileSystemWatcherRecoveryAborted(_path);
                }
                else
                {
                    _logger.AutoRecoveringFileSystemWatcherRecovered(_path);
                }

                Interlocked.Exchange(ref _recovering, 0);
            });
        }
예제 #18
0
        protected void OnFileWatcherError(ErrorEventArgs args)
        {
            if (Interlocked.CompareExchange(ref _recovering, 1, 0) != 0)
            {
                return;
            }

            string errorMessage = args.GetException()?.Message ?? "Unknown";

            Trace($"Failure detected '{errorMessage}'. Initiating recovery...", TraceLevel.Warning);

            Recover().ContinueWith(t =>
            {
                if (t.IsFaulted || t.IsCanceled)
                {
                    t.Exception?.Handle(e => true);
                    Trace($"Recovery process aborted.", TraceLevel.Error);
                }
                else
                {
                    Trace("File watcher recovered.", TraceLevel.Info);
                }

                Interlocked.Exchange(ref _recovering, 0);
            });
        }
 private void onClientError(object sender, ErrorEventArgs e)
 {
     if (e.GetException() is SocketException)
     {
         MessageBox.Show("Couldn't find the server!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void OnError(object sender, ErrorEventArgs e)
 {
     logger.LogError(e.GetException(),
                     "An error occurred while watching the manifest directory changes. " +
                     $"Directory: {manifestDir}."
                     );
 }
예제 #21
0
        /// <summary>
        /// Inoked when the wrapped watcher throws an exception. The exception is tested with the existing policies
        /// and handled according to the tests results.
        /// </summary>
        /// <param name="sender">Raiser of the event</param>
        /// <param name="e">Error event args</param>
        protected override void OnError(Object sender, ErrorEventArgs e)
        {
            Exception ex     = e.GetException();
            Type      exType = ex.GetType();
            WatcherErrorHandlingType exHandling = ErrorHandlingPolicies.Where(policy => policy.ExceptionType == exType)
                                                  .Aggregate(WatcherErrorHandlingType.Forward, (current, relevantPolicy) => current | relevantPolicy.Test(ex));

            // Testing all relevant policies according to the exception type

            // Check the policies test results.

            //  If ANY of the policies requested a refresh - a refresh will be invoked
            if (exHandling.HasFlag(WatcherErrorHandlingType.Refresh))
            {
                // Tries to refresh. If a refresh is already in progress, the thread returns.
                _ = RefreshAsync(false);
            }

            //  If NONE of the policies requested a swallow - the error will be forwarded
            //  (if any of them DID request a swallow, the error will be swallowed)
            if (!exHandling.HasFlag(WatcherErrorHandlingType.Swallow))
            {
                base.OnError(sender, e);
            }
        }
예제 #22
0
 private static void WatcherOnError(object sender, ErrorEventArgs e)
 {
     if (Logger.IsInfoEnabled)
     {
         Logger.Info("Watcher Activity: N/A. Error: " + e.GetException());
     }
 }
예제 #23
0
        private void OnError(object sender, ErrorEventArgs e)
        {
            Exception ex = e.GetException();

            TraceFactory.GetTracer().TraceError(ex.ToString());
            ResetWatcher();
        }
예제 #24
0
        static void codeExporter_Error(object sender, ErrorEventArgs e)
        {
            var    exception    = e.GetException();
            string errorMessage = exception.Message;

            Console.WriteLine(errorMessage);
        }
 private void OnError(object source, ErrorEventArgs myEvent)
 {
     if (myEvent.GetException().GetType() == typeof(InternalBufferOverflowException))
     {
         //  This can happen if Windows is reporting many file system events quickly
         //  and internal buffer of the  FileSystemWatcher is not large enough to handle this
         //  rate of events. The InternalBufferOverflowException error informs the application
         //  that some of the file system events are being lost.
         Console.WriteLine($"The file system watcher experienced an internal buffer overflow: {myEvent.GetException().Message}");
         Logger.Log($"The file system watcher experienced an internal buffer overflow: {myEvent.GetException().Message}");
     }
     else
     {
         Console.WriteLine($"The file sytem watcher has trigerred an unknown error: {myEvent.GetException().Message}");
         Logger.Log($"The file sytem watcher has trigerred an unknown error: {myEvent.GetException().Message}");
     }
 }
예제 #26
0
        /// <summary>
        /// This function is invoked when filewatcher has an error
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnFileWatcherError(object sender, ErrorEventArgs e)
        {
            m_logging.Log(DateTime.Now.ToString() + " Error Detected In Handler Of Directory " + m_path, MessageTypeEnum.FAIL);
            DirectoryCloseEventArgs args = new DirectoryCloseEventArgs(m_path, e.GetException().ToString());

            DirectoryClose?.Invoke(this, args);
            CloseHandler();
        }
예제 #27
0
 private void Error(object sender, ErrorEventArgs e)
 {
     using (var logger = _logger.Block())
     {
         logger.Trace($"Notifying {_observers.Count} observers of error...");
         _observers.ForEach(o => o.OnError(e.GetException()));
     }
 }
예제 #28
0
        private void OnError(object sender, ErrorEventArgs e)
        {
            var exception = e.GetException();

            var logger = LogManager.GetCurrentClassLogger();

            logger.Error(exception, $"Error while watching for filesystem changes: {exception.Message}");
        }
예제 #29
0
 private static void OnError(object source, ErrorEventArgs e)
 {
     Console.WriteLine("The FileSystemWatcher has detected an error");
     if (e.GetException().GetType() == typeof(InternalBufferOverflowException))
     {
         Console.WriteLine(("The file system watcher experienced an internal buffer overflow: " + e.GetException().Message));
     }
 }
        private static void Watcher_Error(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();

            Console.WriteLine($"Ocorreu o seguinte erro: {ex.Message}");
            Console.WriteLine($"StackTrace: { ex.StackTrace}");
            Console.WriteLine(ex.InnerException != null ? $"InnerException: {ex.InnerException.Message}" : string.Empty);
        }
예제 #31
0
        private void WatcherError(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();

            Console.Error.WriteLine(ex);
            this.lastError     = ex;
            this.lastErrorTime = DateTime.Now;
        }
예제 #32
0
        private void OnError(object source, ErrorEventArgs e)
        {
            string msg = $"Watcher failed: {e.GetException()} source={source} {source.GetHashCode()}";

            _output.WriteLine(msg);
            // Repeat on Console so it easier to triage in CI.
            Console.WriteLine(msg);
        }
 private void OnError(object sender, ErrorEventArgs e)
 {
     if (IsNullOrEmpty(_result))
     {
         _error = e.GetException();
     }
     _continuation();
 }