log unhandle exception
This commit is contained in:
@@ -55,12 +55,18 @@ namespace Shadowsocks
|
||||
}
|
||||
}
|
||||
|
||||
private static int exited = 0;
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Logging.Error(e.ExceptionObject?.ToString());
|
||||
MessageBox.Show($"Unexpect error, shadowsocks exited.{Environment.NewLine} {e.ExceptionObject?.ToString()}",
|
||||
"Shadowsocks", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
if (Interlocked.Increment(ref exited) == 1)
|
||||
{
|
||||
Logging.Error(e.ExceptionObject?.ToString());
|
||||
MessageBox.Show(I18N.GetString("Unexpect error, shadowsocks will be exit. Please report to") +
|
||||
" https://github.com/shadowsocks/shadowsocks-windows/issues " +
|
||||
Environment.NewLine + (e.ExceptionObject?.ToString()),
|
||||
"Shadowsocks Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user