Пример #1
0
        public static void ShowAppError(Exception ex)
        {
            frmException frm = CreateExceptionForm(ex);

            System.Media.SystemSounds.Exclamation.Play();
            frm.ShowDialog();
        }
Пример #2
0
        private static frmException CreateExceptionForm(Exception ex)
        {
            frmException frm = new frmException();

            frm.exception = ex;
            if (ex != null)
            {
                frm.txtDetailMsg.Text  = "EXCEPTION TYPE:\r\n" + ex.GetType().ToString();
                frm.txtDetailMsg.Text += "\r\n";
                frm.txtDetailMsg.Text += "\r\nMESSAGE:\r\n " + ex.Message;
                frm.txtDetailMsg.Text += "\r\n";
                if (ex.InnerException != null && !String.IsNullOrEmpty(ex.InnerException.Message))
                {
                    frm.txtDetailMsg.Text += "\r\nINNER EXCEPTION MESSAGE:\r\n" + ex.InnerException.Message;
                    frm.txtDetailMsg.Text += "\r\n";
                }
                frm.txtDetailMsg.Text           += "\r\nSTACK TRACE:\r\n " + ex.StackTrace;
                frm.txtDetailMsg.SelectionStart  = 0;
                frm.txtDetailMsg.SelectionLength = 0;

                frm.txtShortMsg.Text = ex.Message;
            }
            else
            {
                frm.txtDetailMsg.Text = "Unknown error.";
                frm.txtShortMsg.Text  = frm.txtDetailMsg.Text;
            }

            return(frm);
        }
Пример #3
0
        public static void ShowAppError(string summary, Exception ex)
        {
            frmException frm = CreateExceptionForm(ex);

            frm.txtDetailMsg.Text = "ERROR SUMMARY: " + summary + "\r\n" + "\r\n" + frm.txtDetailMsg.Text;
            if (!String.IsNullOrEmpty(summary))
            {
                frm.txtShortMsg.Text = summary;
            }

            System.Media.SystemSounds.Exclamation.Play();
            frm.ShowDialog();
        }