Better error message to debug an exception.

This commit is contained in:
Myrd
2015-01-21 04:15:28 +00:00
parent f32a2412b6
commit 4a90436589

View File

@@ -92,8 +92,6 @@ public final class AbilityFactory {
* @return a {@link forge.game.spellability.SpellAbility} object.
*/
public static final SpellAbility getAbility(final String abString, final Card hostCard) {
Map<String, String> mapParams;
try {
mapParams = AbilityFactory.getMapParams(abString);
@@ -104,9 +102,10 @@ public final class AbilityFactory {
// parse universal parameters
AbilityRecordType type = AbilityRecordType.getRecordType(mapParams);
if( null == type )
throw new RuntimeException("AbilityFactory : getAbility -- no API in " + hostCard.getName());
if (null == type) {
String source = hostCard.getName().isEmpty() ? abString : hostCard.getName();
throw new RuntimeException("AbilityFactory : getAbility -- no API in " + source);
}
return getAbility(type, type.getApiTypeOf(mapParams), mapParams, parseAbilityCost(hostCard, mapParams, type), hostCard);
}