本文整理汇总了C#中System.IO.ErrorEventArgs.GetException方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorEventArgs.GetException方法的具体用法?C# ErrorEventArgs.GetException怎么用?C# ErrorEventArgs.GetException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.ErrorEventArgs
的用法示例。
在下文中一共展示了ErrorEventArgs.GetException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateErrorEventArgs
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());
}
示例2: OnError
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);
}
示例3: OnError
private void OnError(object sender, ErrorEventArgs e)
{
e.GetException().ToExceptionless().Submit();
if (InvokeRequired)
{
BeginInvoke(new ErrorEventHandler(OnError), sender, e);
return;
}
MessageBox.Show(Constants.Messages.Error + e.GetException().InnerException,
Constants.Messages.ErrorCaption,
MessageBoxButtons.OK, MessageBoxIcon.Error);
Console.WriteLine(Constants.Messages.Error + e.GetException().InnerException);
}
示例4: PackReceived_Error
private void PackReceived_Error(object sender, ErrorEventArgs e)
{
Terminal.Instance.Client.Notifier.Log(TraceLevel.Error, e.GetException().ToString());
}
示例5: watcher_Error
/// <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);
}
示例6: OnFileError
/// <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);
}
示例7: watcher_Error
/// <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);
}
}
示例8: onError
void onError(object sender, ErrorEventArgs e)
{
throw new Exception("{0}: File system watcher error {1}".format(_path, e.GetException().Message));
}
示例9: GameManagerOnOnError
private void GameManagerOnOnError(object sender, ErrorEventArgs errorEventArgs)
{
MessageBox.Show(errorEventArgs.GetException().ToString(), "Error creating game");
}
示例10: watcher_Error
void watcher_Error(object sender, ErrorEventArgs e)
{
MPTVSeriesLog.Write("File Watcher: Error event: " + e.GetException().Message);
refreshWatchers = true;
}
示例11: watcher_Error
private void watcher_Error(object sender, ErrorEventArgs e)
{
Interface.Oxide.NextTick(() =>
{
Interface.Oxide.LogError("FSWatcher error: {0}", e.GetException());
RemoteLogger.Exception("FSWatcher error", e.GetException());
});
}
示例12: ConfirmedCommandConverter_Error
private void ConfirmedCommandConverter_Error(object sender, ErrorEventArgs e)
{
_tracer.TraceError(e.GetException());
}
示例13: FileSystemWatcherError
void FileSystemWatcherError(object source, ErrorEventArgs e)
{
Console.WriteLine(e.GetException().ToString());
}
示例14: w_Error
static void w_Error(object sender, ErrorEventArgs e) {
var h = Program.WatchNotify;
var ex = e.GetException();
if (!(ex is System.IO.IOException)) {
if (h != null) {
h(sender, new WatcherNotifyEventArgs(true, e.GetException()));
} else {
Console.WriteLine("Error: {0} : {1}",
e.GetException().GetType().Name,
e.GetException().Message);
}
}
}
示例15: OnError
private void OnError(object sender, ErrorEventArgs e)
{
// 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 =>
{
Exception ex = e.GetException();
_traceFactory.GetTracer().TraceError(ex.ToString());
ResetWatcher();
});
}