mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-09 23:34:06 +02:00
Move unhandled exception handler from Program to Reporter class
This commit is contained in:
parent
45e6ec8b0f
commit
3f0028913d
@ -60,14 +60,7 @@ private static void Main(){
|
||||
}
|
||||
|
||||
Reporter = new Reporter(LogFilePath);
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
|
||||
Exception ex = args.ExceptionObject as Exception;
|
||||
|
||||
if (ex != null){
|
||||
Reporter.HandleException(BrandName+" Has Failed :(", "An unhandled exception has occurred.", false, ex);
|
||||
}
|
||||
};
|
||||
Reporter.SetupUnhandledExceptionHandler(BrandName+" Has Failed :(");
|
||||
|
||||
if (Args.HasFlag("-restart")){
|
||||
for(int attempt = 0; attempt < 21; attempt++){
|
||||
|
10
Reporter.cs
10
Reporter.cs
@ -15,6 +15,16 @@ public Reporter(string logFile){
|
||||
this.logFile = logFile;
|
||||
}
|
||||
|
||||
public void SetupUnhandledExceptionHandler(string caption){
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
|
||||
Exception ex = args.ExceptionObject as Exception;
|
||||
|
||||
if (ex != null){
|
||||
HandleException(caption, "An unhandled exception has occurred.", false, ex);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public bool Log(string data){
|
||||
StringBuilder build = new StringBuilder();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user