aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes
diff options
context:
space:
mode:
authorBruce Wells <bruce.wells@simparel.com>2018-08-28 00:47:28 +0300
committerBruce Wells <bruce.wells@simparel.com>2018-08-28 00:47:28 +0300
commitaf2436d7cc555216526052b901583c0e75dddb24 (patch)
tree16ed1a23074c71517bffcd8b55692e9ee3dd900d /src/NXP/Classes
parentb04cf54aa3e4d31bcea43011b371c75d168ac7f6 (diff)
Exception Messages
Basically the token that is causing the exception for better diagnostics.
Diffstat (limited to 'src/NXP/Classes')
-rw-r--r--src/NXP/Classes/Calculator.php2
-rw-r--r--src/NXP/Classes/TokenFactory.php6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/NXP/Classes/Calculator.php b/src/NXP/Classes/Calculator.php
index 41e0d9f..b584d69 100644
--- a/src/NXP/Classes/Calculator.php
+++ b/src/NXP/Classes/Calculator.php
@@ -40,7 +40,7 @@ class Calculator
if ($token instanceof TokenVariable) {
$variable = $token->getValue();
if (!array_key_exists($variable, $variables)) {
- throw new UnknownVariableException();
+ throw new UnknownVariableException($variable);
}
$value = $variables[$variable];
array_push($stack, new TokenNumber($value));
diff --git a/src/NXP/Classes/TokenFactory.php b/src/NXP/Classes/TokenFactory.php
index 19ba1cf..07b9ea8 100644
--- a/src/NXP/Classes/TokenFactory.php
+++ b/src/NXP/Classes/TokenFactory.php
@@ -61,7 +61,7 @@ class TokenFactory
$class = new \ReflectionClass($operatorClass);
if (!in_array('NXP\Classes\Token\InterfaceToken', $class->getInterfaceNames())) {
- throw new UnknownOperatorException;
+ throw new UnknownOperatorException($operatorClass);
}
$this->operators[] = $operatorClass;
@@ -140,10 +140,10 @@ class TokenFactory
if (isset($this->functions[$token])) {
return new TokenFunction($this->functions[$token]);
} else {
- throw new UnknownFunctionException();
+ throw new UnknownFunctionException($token);
}
}
- throw new UnknownTokenException();
+ throw new UnknownTokenException($token);
}
}