Skip to content

Commit 4063958

Browse files
committed
bug symfony#26338 [Debug] Keep previous errors of Error instances (Philipp91)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes symfony#26338). Discussion ---------- [Debug] Keep previous errors of Error instances | Q | A | ------------- | --- | Branch? | 2.7 (I have tested against 4.0, but I guess it applies to all the older versions too) | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | ? | Fixed tickets | -- | License | MIT Passing on the previous exception gives developers better debugging information. In particular, if you throw an uncaught `new \Error("Something", 0, new \Exception("Inner exception"))` or sth. like that today, you will not see the "Inner exception" text (which may be more helpful than the outer error) in the HTTP debug response. Converting exceptions into errors this way is a common pattern when an exception raised in a sub-routine cannot reasonably occur for a specific caller situation, so there it becomes an `AssertionError` instead. Commits ------- b1b6093 Pass on previous exception in FatalThrowableError
2 parents 2f4b867 + b1b6093 commit 4063958

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/Debug/Exception/FatalThrowableError.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public function __construct(\Throwable $e)
3636
$e->getCode(),
3737
$severity,
3838
$e->getFile(),
39-
$e->getLine()
39+
$e->getLine(),
40+
$e->getPrevious()
4041
);
4142

4243
$this->setTrace($e->getTrace());

0 commit comments

Comments
 (0)