changeset 242:91ee6259677f

* Make "armourType" parse error more informative no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Feb 2010 15:02:42 +0000
parents 50f845c117e9
children b8883707c489
files api/Factories/Xml/WarFoundryXmlRaceFactory.cs
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Feb 27 14:44:09 2010 +0000
+++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Feb 27 15:02:42 2010 +0000
@@ -440,13 +440,15 @@
 				throw new InvalidFileException("Attribute 'cost' of equipment item "+id+" was not a valid number", ex);
 			}			
 			
+			string armourTypeAttrib = elem.GetAttribute("armourType");
+			
 			try
 			{
-				armourType = (ArmourType)Enum.Parse(typeof(ArmourType), elem.GetAttribute("armourType"));
+				armourType = (ArmourType)Enum.Parse(typeof(ArmourType), armourTypeAttrib);
 			}
 			catch(ArgumentException ex)
 			{
-				throw new InvalidFileException("Attribute 'armourType' of equipment "+id+" was not a valid value from the enumeration", ex);
+				throw new InvalidFileException("Attribute value '"+armourTypeAttrib+"' for 'armourType' of equipment "+id+" was not one of the allowed values", ex);
 			}
 			
 			//TODO: Parse equipment stats if there are any