Ejemplo n.º 1
0
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            if (e.ExceptionObject is DeException)
            {
                DeException dx = e.ExceptionObject as DeException;

                if (logger != null)
                {
                    logger.Error("Application_ThreadException,errorcode is " + dx.ErrorCode, dx.InnerException);
                }

                if (!dx.ErrorCode.Equals(""))
                {
                    MessageBox.Show(String.Format("错误编码{0},{1}---{2}", dx.ErrorCode, dx.Message, dx.StackTrace));
                }
            }
            else
            {
                Exception ex = e.ExceptionObject as Exception;

                if (logger != null)
                {
                    logger.Error("CurrentDomain_UnhandledException", ex);
                }

                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            if (e.Exception is DeException)
            {
                DeException dx = e.Exception as DeException;

                if (logger != null)
                {
                    logger.Error("Application_ThreadException,errorcode is " + dx.ErrorCode, dx.InnerException);
                }

                MessageBox.Show(String.Format("错误编码{0},{1}---{2}", dx.ErrorCode, dx.Message, dx.StackTrace));
            }
            else
            {
                if (logger != null)
                {
                    logger.Error("Application_ThreadException", e.Exception);
                }

                MessageBox.Show(e.Exception.Message);
            }
        }