Skip to content

Commit

Permalink
Throw the actual exception when using a modifier, if one exists, so w…
Browse files Browse the repository at this point in the history
…e can see the right stack trace
  • Loading branch information
jasonvarga committed Nov 5, 2020
1 parent a569c43 commit 0c443f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Modifiers/Modify.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function modify($modifier, $params = [])
} catch (Exception $e) {
// If a modifier's code raised an exception, we'll just
// catch it here and rethrow it as a ModifierException.
$e = new ModifierException($e->getMessage());
$e = new ModifierException($e->getMessage(), 0, $e);
$e->setModifier($modifier);
throw $e;
}
Expand Down
2 changes: 1 addition & 1 deletion src/View/Antlers/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ protected function runModifier($modifier, $data, $parameters, $context = [])
try {
return Modify::value($value)->context($context)->$modifier($parameters)->fetch();
} catch (ModifierException $e) {
throw_if(config('app.debug'), $e);
throw_if(config('app.debug'), ($prev = $e->getPrevious()) ? $prev : $e);
Log::notice(sprintf('Error in [%s] modifier: %s', $e->getModifier(), $e->getMessage()));

return $value;
Expand Down

0 comments on commit 0c443f7

Please sign in to comment.