コード例 #1
0
ファイル: ExceptionManager.cs プロジェクト: rizwan3d/elalang
        public static void Process(IApp app, Exception exception)
        {
            if (exception is ThreadAbortException ||
                exception == null)
                return;

            lock (syncRoot)
            {
                var d = new ExceptionDialog();
                d.ExceptionMessage = exception.Message;
                d.ExceptionDetails = exception.ToString();
                d.ShowDialog(WB.Form);

                if (d.SendMail)
                {
                    var dump = new ExceptionDump(exception);
                    var sender = new DumpSender
                    {
                        To = SenderData.Recipient,
                        Credentials = new NetworkCredential(SenderData.Login, SenderData.Password)
                    };

                    if (!sender.SendDump(dump.GenerateDump(true)))
                        MessageBox.Show(sender.Error, Application.ProductName,
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Log(exception);
                app.Unload();
            }
        }
コード例 #2
0
        public static void Process(IApp app, Exception exception)
        {
            if (exception is ThreadAbortException ||
                exception == null)
            {
                return;
            }

            lock (syncRoot)
            {
                var d = new ExceptionDialog();
                d.ExceptionMessage = exception.Message;
                d.ExceptionDetails = exception.ToString();
                d.ShowDialog(WB.Form);

                if (d.SendMail)
                {
                    var dump   = new ExceptionDump(exception);
                    var sender = new DumpSender
                    {
                        To          = SenderData.Recipient,
                        Credentials = new NetworkCredential(SenderData.Login, SenderData.Password)
                    };

                    if (!sender.SendDump(dump.GenerateDump(true)))
                    {
                        MessageBox.Show(sender.Error, Application.ProductName,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                Log(exception);
                app.Unload();
            }
        }
コード例 #3
0
ファイル: ExceptionManager.cs プロジェクト: rizwan3d/elalang
        public static void Log(Exception exception)
        {
            if (ErrorLogPath != null)
            {
                lock (syncRoot)
                {
                    try
                    {
                        var dump = new ExceptionDump(exception);

                        using (StreamWriter writer = new StreamWriter(
                            File.Open(ErrorLogPath.FullName, FileMode.Append)))
                            writer.Write(dump.GenerateDump(false));
                    }
                    catch (Exception) { }
                }
            }
        }
コード例 #4
0
        public static void Log(Exception exception)
        {
            if (ErrorLogPath != null)
            {
                lock (syncRoot)
                {
                    try
                    {
                        var dump = new ExceptionDump(exception);

                        using (StreamWriter writer = new StreamWriter(
                                   File.Open(ErrorLogPath.FullName, FileMode.Append)))
                            writer.Write(dump.GenerateDump(false));
                    }
                    catch (Exception) { }
                }
            }
        }