Browse Source

log unhandle exception

pull/478/head
Gang Zhuo 8 years ago
parent
commit
579039fe40
2 changed files with 12 additions and 4 deletions
  1. +2
    -0
      shadowsocks-csharp/Data/cn.txt
  2. +10
    -4
      shadowsocks-csharp/Program.cs

+ 2
- 0
shadowsocks-csharp/Data/cn.txt View File

@@ -101,3 +101,5 @@ Failed to decode QRCode=无法解析二维码
Failed to update registry=无法修改注册表 Failed to update registry=无法修改注册表
System Proxy On: =系统代理已启用: System Proxy On: =系统代理已启用:
Running: Port {0}=正在运行:端口 {0} Running: Port {0}=正在运行:端口 {0}
Unexpect error, shadowsocks will be exit. Please report to=非预期错误,Shadowsocks将退出。请提交此错误到

+ 10
- 4
shadowsocks-csharp/Program.cs View File

@@ -55,12 +55,18 @@ namespace Shadowsocks
} }
} }
private static int exited = 0;
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 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();
}
} }
} }
} }

Loading…
Cancel
Save