Skip to content

Commit 0c443f7

Browse files
committed
Throw the actual exception when using a modifier, if one exists, so we can see the right stack trace
1 parent a569c43 commit 0c443f7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Modifiers/Modify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function modify($modifier, $params = [])
157157
} catch (Exception $e) {
158158
// If a modifier's code raised an exception, we'll just
159159
// catch it here and rethrow it as a ModifierException.
160-
$e = new ModifierException($e->getMessage());
160+
$e = new ModifierException($e->getMessage(), 0, $e);
161161
$e->setModifier($modifier);
162162
throw $e;
163163
}

src/View/Antlers/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ protected function runModifier($modifier, $data, $parameters, $context = [])
14581458
try {
14591459
return Modify::value($value)->context($context)->$modifier($parameters)->fetch();
14601460
} catch (ModifierException $e) {
1461-
throw_if(config('app.debug'), $e);
1461+
throw_if(config('app.debug'), ($prev = $e->getPrevious()) ? $prev : $e);
14621462
Log::notice(sprintf('Error in [%s] modifier: %s', $e->getModifier(), $e->getMessage()));
14631463

14641464
return $value;

0 commit comments

Comments
 (0)