provide a more helpful exception

This commit is contained in:
Matthias Mailänder
2015-07-26 18:24:00 +02:00
parent a0c02d5710
commit 894f75fb3b

View File

@@ -156,7 +156,7 @@ namespace OpenRA
if (index >= actors.Count || actors[index].ActorID != actor)
return default(T);
else if (index + 1 < actors.Count && actors[index + 1].ActorID == actor)
throw new InvalidOperationException("Actor has multiple traits of type `{0}`".F(typeof(T)));
throw new InvalidOperationException("Actor {0} has multiple traits of type `{1}`".F(actors[index].Info.Name, typeof(T)));
else return traits[index];
}