InventoryAction: replace isValid() with validate() which throws TransactionValidationException

This commit is contained in:
Dylan K. Taylor
2020-07-04 19:38:34 +01:00
parent cf5e31c619
commit 1d18662d9b
6 changed files with 36 additions and 14 deletions

View File

@ -142,8 +142,10 @@ class InventoryTransaction{
$needItems[] = $action->getTargetItem();
}
if(!$action->isValid($this->source)){
throw new TransactionValidationException("Action " . get_class($action) . " is not valid in the current transaction");
try{
$action->validate($this->source);
}catch(TransactionValidationException $e){
throw new TransactionValidationException(get_class($action) . ": " . $e->getMessage(), 0, $e);
}
if(!$action->getSourceItem()->isNull()){