Mercurial > repos > snowblizz-super-API-ideas
changeset 155:df61d26c23fb
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
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 28 Sep 2009 19:48:37 +0000 |
parents | 4a02c07278e7 |
children | 62ff1ac132d2 |
files | api/Factories/RequiredDataMissingException.cs api/Factories/Xml/WarFoundryXmlArmyParser.cs |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 { /// <summary> /// 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 @@ /// </summary> 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)) { } }
--- 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");