Merge pull request #1539 from markusstoll/exceptionhandler

catch unhandled exceptions
This commit is contained in:
Hylke Bons 2014-07-27 14:25:20 +02:00
commit 3fd5e7cd0d

View file

@ -68,6 +68,8 @@ namespace SparkleShare {
}
try {
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
Controller = new SparkleController ();
Controller.Initialize ();
@ -85,5 +87,18 @@ namespace SparkleShare {
GC.WaitForPendingFinalizers ();
#endif
}
static void OnUnhandledException(object sender, UnhandledExceptionEventArgs exception_args)
{
try
{
var e = (Exception)exception_args.ExceptionObject;
SparkleLogger.WriteCrashReport(e);
}
finally
{
Environment.Exit (-1);
}
}
}
}