lixiaojun
2025-01-20 bef933e7e166b085ba7e46e38ea62d9ae0129ec6
Desktop/HStation.Desktop.Xhs.Core/Program.cs
@@ -1,6 +1,7 @@
using DevExpress.LookAndFeel;
using Mapster;
using System.Reflection;
using Yw.WinFrmUI;
namespace HStation.Desktop
{
@@ -96,15 +97,32 @@
        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            var ex = e.Exception;
            Yw.LogHelper.Error("系统出现未知异常,ERROR:249", ex);
            MessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}");
            if (ex is Yw.Dto.InternalException internalEx)
            {
                Yw.LogHelper.Error("系统出现内部异常,ERROR:249", internalEx);
                MessageBoxHelper.ShowError(internalEx.ErrorMsg);
            }
            else
            {
                Yw.LogHelper.Error("系统出现未知异常,ERROR:249", ex);
                MessageBoxHelper.ShowError($"系统出现未知异常,请重启系统!\r\n{ex.Message}");
            }
        }
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var ex = e.ExceptionObject as Exception;
            Yw.LogHelper.Error("系统出现未知异常,ERROR:255", ex);
            MessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}");
            if (ex is Yw.Dto.InternalException internalEx)
            {
                Yw.LogHelper.Error("系统出现内部异常,ERROR:249", internalEx);
                MessageBoxHelper.ShowError(internalEx.ErrorMsg);
            }
            else
            {
                Yw.LogHelper.Error("系统出现未知异常,ERROR:255", ex);
                MessageBoxHelper.ShowError($"系统出现未知异常,请重启系统!\r\n{ex.Message}");
            }
        }
    }
}