From 464d373dc48be784d61ed8f457ce45299baa3366 Mon Sep 17 00:00:00 2001 From: Nicholas Cole Date: Wed, 30 Aug 2017 12:05:11 +1000 Subject: [PATCH] Issue #2817683: handle invalid tokens gracefully. --- src/Engine/ExecutionState.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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]; } /**