diff FrmMainWindow.cs @ 52:4bad8cb3f889

Re #60: Add UI to add/remove/edit weapons in GTK * Remove "not implemented" exceptions and add first implementation of setting equipment list * Add widgets to add equipment form * Subscribe to Clicked instead of Activated to hook on to correct event * Extract tree rendering method into helper class Also: * Improve exception handling of unhandled exceptions (print full stack trace with "caused by" hierarchy)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Aug 2010 14:32:16 +0000
parents 07fd9f7b0dd1
children 293d204e40db
line wrap: on
line diff
--- a/FrmMainWindow.cs	Sat Aug 21 20:00:03 2010 +0000
+++ b/FrmMainWindow.cs	Sun Aug 22 14:32:16 2010 +0000
@@ -90,10 +90,22 @@
 
 		private static void HandleUnhandledException(Exception ex)
 		{
-			LogManager.GetLogger(typeof(FrmMainWindow)).Fatal("(" + ex.GetType().Name + ") " + ex.Message + Environment.NewLine + ex.StackTrace);
+			LogManager.GetLogger(typeof(FrmMainWindow)).FatalFormat("({0}) {1} {2} {3}", ex.GetType().FullName, ex.Message, Environment.NewLine, GetStackTrace(ex));
 			MessageDialog dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "An unhandled exception occurred. Please check the log for more details.");
 			dialog.Show();
 		}
+		
+		private static string GetStackTrace(Exception ex)
+		{
+			string message = "";
+			
+			if (ex != null)
+			{
+				message  = "Caused by: " + ex.GetType().FullName + Environment.NewLine + ex.StackTrace + Environment.NewLine + GetStackTrace(ex.InnerException);
+			}
+			
+			return message;
+		}
 
 		public FrmMainWindow() : this(new string[0])
 		{