/// ------------------------------------------------------------------------------------ /// <summary> /// Catches and displays a otherwise unhandled exception. /// </summary> /// <param name="sender">sender</param> /// <param name="e">Exception</param> /// <remarks>previously <c>AfApp::HandleTopLevelError</c></remarks> /// ------------------------------------------------------------------------------------ protected void HandleTopLevelError(object sender, ThreadExceptionEventArgs e) { if (!GetShouldHandleException(sender, e.Exception)) { return; } if (UseFallback) { _fallbackHandler.HandleTopLevelError(sender, e); return; } if (DisplayError(e.Exception)) { //Are we inside a Application.Run() statement? if (Application.MessageLoop) { Application.Exit(); } else { Environment.Exit(1); //the 1 here is just non-zero } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Catches and displays a otherwise unhandled exception. /// </summary> /// <param name="sender">sender</param> /// <param name="e">Exception</param> /// <remarks>previously <c>AfApp::HandleTopLevelError</c></remarks> /// ------------------------------------------------------------------------------------ protected void HandleTopLevelError(object sender, ThreadExceptionEventArgs e) { if (!GetShouldHandleException(sender, e.Exception)) return; if (UseFallback) { if (Program.RunningHarvesterMode) Console.WriteLine("Uncaught Exception: {0}", e.Exception); else _fallbackHandler.HandleTopLevelError(sender, e); return; } if (DisplayError(e.Exception)) { //Are we inside a Application.Run() statement? if (Application.MessageLoop) Application.Exit(); else Environment.Exit(1); //the 1 here is just non-zero } }