diff --git a/src/Engine/ExecutionState.php b/src/Engine/ExecutionState.php index 49647742..e9860f08 100644 --- a/src/Engine/ExecutionState.php +++ b/src/Engine/ExecutionState.php @@ -99,10 +99,12 @@ public function setVariableData($name, TypedDataInterface $data) { * {@inheritdoc} */ public function getVariable($name) { - if (!$this->hasVariable($name)) { - throw new EvaluationException("Unable to get variable $name, it is not defined."); + try { + return $this->variables[$name]; + } + catch (InvalidArgumentException $e) { + throw new EvaluationException($e->getMessage(), 0, $e); } - return $this->variables[$name]; } /**