Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 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 | f5009a00a50d |
children | a54da5a8b5bb |
comparison
equal
deleted
inserted
replaced
241:50f845c117e9 | 242:91ee6259677f |
---|---|
438 catch(FormatException ex) | 438 catch(FormatException ex) |
439 { | 439 { |
440 throw new InvalidFileException("Attribute 'cost' of equipment item "+id+" was not a valid number", ex); | 440 throw new InvalidFileException("Attribute 'cost' of equipment item "+id+" was not a valid number", ex); |
441 } | 441 } |
442 | 442 |
443 string armourTypeAttrib = elem.GetAttribute("armourType"); | |
444 | |
443 try | 445 try |
444 { | 446 { |
445 armourType = (ArmourType)Enum.Parse(typeof(ArmourType), elem.GetAttribute("armourType")); | 447 armourType = (ArmourType)Enum.Parse(typeof(ArmourType), armourTypeAttrib); |
446 } | 448 } |
447 catch(ArgumentException ex) | 449 catch(ArgumentException ex) |
448 { | 450 { |
449 throw new InvalidFileException("Attribute 'armourType' of equipment "+id+" was not a valid value from the enumeration", ex); | 451 throw new InvalidFileException("Attribute value '"+armourTypeAttrib+"' for 'armourType' of equipment "+id+" was not one of the allowed values", ex); |
450 } | 452 } |
451 | 453 |
452 //TODO: Parse equipment stats if there are any | 454 //TODO: Parse equipment stats if there are any |
453 item.Cost = cost; | 455 item.Cost = cost; |
454 item.ItemArmourType = armourType; | 456 item.ItemArmourType = armourType; |