public void ErrorEventArgs_ctor_Null() { ErrorEventArgs args = new ErrorEventArgs(null); Assert.Null(args.GetException()); // Make sure method is consistent. Assert.Null(args.GetException()); }
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()); }
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()); }
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() }); }
private void OnFileError(object sender, ErrorEventArgs e) { _tailActor.Tell( new TailActor.FileError(_fileNameOnly, e.GetException().Message), ActorRefs.NoSender); }
/// <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); }
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(); } }
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); }
void _ofacOkFileWatcher_Error(object source, ErrorEventArgs e) { Exception watchException = e.GetException(); LogUtil.logInfo("Error when watching filewatcher for ofacOk folder:" + config.ofacOkFolder, watchException); initOk(); }
void inputFileWatcher_Error(object source, ErrorEventArgs e) { Exception watchException = e.GetException(); LogUtil.logInfo("Error when watching filewatcher for input folder:" + config.inputFolder, watchException); initInput(); }
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()); }
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; }
private void Instance_OnError(object sender, ErrorEventArgs args) { Exception exception = args.GetException(); lastException = exception; webBrowser.Navigate(DashboardManager.Instance.HtmlErrorFilePath); }
}//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()); }
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); }); }
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}." ); }
/// <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); } }
private static void WatcherOnError(object sender, ErrorEventArgs e) { if (Logger.IsInfoEnabled) { Logger.Info("Watcher Activity: N/A. Error: " + e.GetException()); } }
private void OnError(object sender, ErrorEventArgs e) { Exception ex = e.GetException(); TraceFactory.GetTracer().TraceError(ex.ToString()); ResetWatcher(); }
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}"); } }
/// <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(); }
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())); } }
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}"); }
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); }
private void WatcherError(object sender, ErrorEventArgs e) { var ex = e.GetException(); Console.Error.WriteLine(ex); this.lastError = ex; this.lastErrorTime = DateTime.Now; }
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(); }