Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
diff FrmMainWindow.cs @ 8:20c5fd0bb79d
Fixes #5 - Stop missing translations being fatal
* Catch TranslationLoadExceptions thrown when initialising translations and display the message to the user
Also:
* Random GUI cleanup that MonoDevelop wanted to do
* Add exception type name to last-ditch "log what killed us" exception handling so that we can more easily identify the exception thrown
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 05 Mar 2009 20:37:25 +0000 |
parents | cfc7683e73f9 |
children | c687bbe901f8 |
line wrap: on
line diff
--- a/FrmMainWindow.cs Tue Feb 17 16:41:55 2009 +0000 +++ b/FrmMainWindow.cs Thu Mar 05 20:37:25 2009 +0000 @@ -63,7 +63,7 @@ } catch(Exception ex) { - LogManager.GetLogger(typeof(FrmMainWindow)).Fatal(ex.Message + Environment.NewLine + ex.StackTrace); + LogManager.GetLogger(typeof(FrmMainWindow)).Fatal("("+ex.GetType().Name+") "+ex.Message + Environment.NewLine + ex.StackTrace); } } @@ -103,7 +103,20 @@ logger.Debug("Loading preferences"); Preferences = new Preferences("WarFoundryGTK"); logger.Debug("Loading translations"); - Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); + + try + { + Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); + } + catch (TranslationLoadException ex) + { + logger.Error(ex); + MessageDialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, ex.Message); + dialog.Title = "Translation loading failed"; + dialog.Run(); + dialog.Destroy(); + } + logger.Debug("Initialising"); commandStack = new CommandStack(); commandStack.CommandStackUpdated+=new MethodInvoker(commandStack_CommandStackUpdated);