diff options
Diffstat (limited to 'win/C#/Program.cs')
-rw-r--r-- | win/C#/Program.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/win/C#/Program.cs b/win/C#/Program.cs index 3085664fc..2bd66db5b 100644 --- a/win/C#/Program.cs +++ b/win/C#/Program.cs @@ -21,6 +21,8 @@ namespace Handbrake [STAThread]
public static void Main()
{
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
+
const string failedInstall = "HandBrake is not installed properly. Please reinstall HandBrake. \n\n";
const string nightlyCLIMissing =
"If you have downloaded the \"HandBrakeGUI\" nightly, " +
@@ -61,5 +63,19 @@ namespace Handbrake Application.Run(new frmMain());
}
}
+
+ /// <summary>
+ /// Throw up an error message for any unhandled exceptions.
+ /// </summary>
+ /// <param name="sender">The sender</param>
+ /// <param name="e">Unhandled Exception EventArgs </param>
+ private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(
+ "An unexpected error has occured.\n\nSender:" + sender + "\n\nException:" + e.ExceptionObject,
+ "Unhandled Exception",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
}
}
\ No newline at end of file |