/[AnywhereTS-MSSQL]/trunk/TSControlPanel/Program.cs
ViewVC logotype

Diff of /trunk/TSControlPanel/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/TSControlPanel/Program.cs	2012/07/12 19:40:36	68
+++ trunk/TSControlPanel/Program.cs	2012/07/12 20:06:53	69
@@ -45,14 +45,14 @@
             if (e.GetType() == typeof(SqlException))
             {
                 SqlException sql_ex = (e as SqlException);
-                Stack stack = new Stack();
-                using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString())))
+                List<object> strs = new List<object>();
+                using (log4net.NDC.Push(string.Format("{0}: ID={1} MESSAGE={2}{3}Diagnostics:{3}{4}", sql_ex.GetType().Name, sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString())))
                 {
-                    stack = log4net.NDC.CloneStack();
-                    Logging.TSControlPanelLog.Error("Encountered unhandled SqlException");
+                    Stack stack = log4net.NDC.CloneStack();
+                    strs = new List<object>(stack.ToArray());
+                    strs.Reverse();
+                    Logging.TSControlPanelLog.Error("Encountered unhandled Exception");
                 }
-                List<object> strs = new List<object>(stack.ToArray());
-                strs.Reverse();
                 StringBuilder builder = new StringBuilder();
                 foreach (object str in strs) { builder.AppendLine(str.ToString()); }
                 result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString());
@@ -61,14 +61,14 @@
             }
             else
             {
-                Stack stack = new Stack();
-                using (log4net.NDC.Push(string.Format("Exception: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
+                List<object> strs = new List<object>();
+                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString())))
                 {
-                    stack = log4net.NDC.CloneStack();
+                    Stack stack = log4net.NDC.CloneStack();
+                    strs = new List<object>(stack.ToArray());
+                    strs.Reverse();
                     Logging.TSControlPanelLog.Error("Encountered unhandled Exception");
-                }                
-                List<object> strs = new List<object>(stack.ToArray());
-                strs.Reverse();
+                } 
                 StringBuilder builder = new StringBuilder();
                 foreach (object str in strs) { builder.AppendLine(str.ToString()); }
                 result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString());

 

  ViewVC Help
Powered by ViewVC 1.1.22