# HG changeset patch # User IBBoard # Date 1254167317 0 # Node ID df61d26c23fb635f8472a0251840c82596d17e6c # Parent 4a02c07278e74c9eb31cb45b0822f544f197e6f1 Re #178: "crash" when loading old .army file with equipment tags that are "old" * Try to tidy up the exception messages - ideally they'll end up translated and localised diff -r 4a02c07278e7 -r df61d26c23fb api/Factories/RequiredDataMissingException.cs --- a/api/Factories/RequiredDataMissingException.cs Mon Sep 28 19:32:52 2009 +0000 +++ b/api/Factories/RequiredDataMissingException.cs Mon Sep 28 19:48:37 2009 +0000 @@ -4,7 +4,7 @@ using System; -namespace IBBoard.WarFoundry.API +namespace IBBoard.WarFoundry.API.Factories { /// /// An exception that is thrown when a file cannot be loaded because one of the data files that it depends on has @@ -12,7 +12,7 @@ /// public class RequiredDataMissingException : Exception { - public RequiredDataMissingException(String file, String missingAttribute, String requiredValue) : base(String.Format("Could not find object with ID {2} for {1} of {0}", file, missingAttribute, requiredValue)) + public RequiredDataMissingException(String file, String missingObjectType, String requiredValue) : base(String.Format("Could not find data for {1} object with ID {2} required by {0}", file, missingObjectType, requiredValue)) { } } diff -r 4a02c07278e7 -r df61d26c23fb api/Factories/Xml/WarFoundryXmlArmyParser.cs --- a/api/Factories/Xml/WarFoundryXmlArmyParser.cs Mon Sep 28 19:32:52 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlArmyParser.cs Mon Sep 28 19:48:37 2009 +0000 @@ -42,7 +42,7 @@ if (system == null) { - throw new RequiredDataMissingException(file.Name, "gameSystem", systemID); + throw new RequiredDataMissingException(file.Name, "Game System", systemID); } string raceID = elem.GetAttribute("race"); @@ -50,7 +50,7 @@ if (race == null) { - throw new RequiredDataMissingException(file.Name, "race", raceID); + throw new RequiredDataMissingException(file.Name, "Race", raceID); } int points = XmlTools.GetIntValueFromAttribute(elem, "maxPoints"); @@ -73,7 +73,7 @@ if (unitType == null) { - throw new RequiredDataMissingException(file.Name, "unitType", unitTypeId); + throw new RequiredDataMissingException(file.Name, "Unit Type", unitTypeId); } string name = unitElem.GetAttribute("unitName"); @@ -101,7 +101,7 @@ if (item == null) { - throw new RequiredDataMissingException(file.Name, "equipItem ID", equipID); + throw new RequiredDataMissingException(file.Name, "Equipment Item", equipID); } double amount = XmlTools.GetDoubleValueFromAttribute(elem, "amount");