Skip to content

Commit 70c68d8

Browse files
committed
bug #2030 Fix: Original Throwable get lost during component render (cuchac)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- Fix: Original Throwable get lost during component render | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Issues | | License | MIT When non-Exception Throwable is thrown during component rendering, original Throwable is lost together with it's stacktrace. Without stacktrace it is hard to debug the problem. This simple change fixes the problem in the same way as in https://github.com/cuchac/ux/blob/f69b9656f318464253590a6575da65f34262d931/src/TwigComponent/src/Twig/ComponentExtension.php#L127 where `previous: $e` is used instead of `previous: $e->getPrevious()` Commits ------- 89552aa Fix: Original Throwable get lost during component render
2 parents 4a80718 + 89552aa commit 70c68d8

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/TwigComponent/src/Twig/ComponentExtension.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ private function throwRuntimeError(string $name, \Throwable $e): void
120120
throw $e;
121121
}
122122

123-
if (!($e instanceof \Exception)) {
124-
$e = new \Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
125-
}
126-
127-
throw new RuntimeError(\sprintf('Error rendering "%s" component: %s', $name, $e->getMessage()), previous: $e);
123+
throw new RuntimeError(\sprintf('Error rendering "%s" component: "%s"', $name, $e->getMessage()), previous: $e);
128124
}
129125
}

0 commit comments

Comments
 (0)