improved error message somewhat when there's a missing sequence

This commit is contained in:
Chris Forbes
2009-12-12 21:21:56 +13:00
parent d26558da12
commit edc954cc8a
3 changed files with 45 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Xml;
using OpenRa.FileFormats;
using System;
namespace OpenRa.Game.Graphics
{
@@ -56,7 +57,12 @@ namespace OpenRa.Game.Graphics
public static Sequence GetSequence(string unitName, string sequenceName)
{
return units[unitName][sequenceName];
try { return units[unitName][sequenceName]; }
catch (KeyNotFoundException e)
{
throw new InvalidOperationException(
"Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName));
}
}
public static CursorSequence GetCursorSequence(string cursor)