If a card could not be parsed due to missing abilities, report name of the card in the exception.
Without this change you would not have known which card is unparseable. before: ScriptParseException: unknown ability "Menace" after: InvalidDeckException: Error parsing Dimir Spybug: unknown ability "Menace"master
parent
a27413e5c1
commit
07b23d478e
|
@ -5,6 +5,9 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import magic.exception.InvalidDeckException;
|
||||
import magic.exception.ScriptParseException;
|
||||
import magic.model.action.LoseGameAction;
|
||||
import magic.model.choice.MagicBuilderManaCost;
|
||||
import magic.model.event.MagicActivationPriority;
|
||||
|
@ -483,7 +486,12 @@ public class MagicPlayer extends MagicObjectImpl implements MagicSource, MagicTa
|
|||
final MagicCardDefinition cardDefinition = deck.get(i);
|
||||
if (cardDefinition.isValid()) {
|
||||
final long id = currGame.getUniqueId();
|
||||
library.add(new MagicCard(cardDefinition,this,id));
|
||||
try {
|
||||
library.add(new MagicCard(cardDefinition, this, id));
|
||||
} catch (ScriptParseException e) {
|
||||
throw new InvalidDeckException(
|
||||
"Error parsing " + cardDefinition.getDistinctName() + ": " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue