Skip to content

Commit

Permalink
bug #35722 [HttpKernel] Set previous exception when rethrown from con…
Browse files Browse the repository at this point in the history
…troller resolver (danut007ro)

This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead.

Discussion
----------

[HttpKernel] Set previous exception when rethrown from controller resolver

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| License       | MIT

If an `\InvalidArgumentException` is catched by ControllerResolver a new one is thrown. The old exception is not added as `previous` parameter on the new one so it is not visible on the exception page. This pull request adds old exception as previous on the new one, so it is also visible on the exception page.

Thank you.

Commits
-------

87d51c1 Set previous exception when rethrown from controller resolver
  • Loading branch information
fabpot committed Feb 15, 2020
2 parents 926e19c + 87d51c1 commit 1a51d34
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -88,7 +88,7 @@ public function getController(Request $request)
try {
$callable = $this->createController($controller);
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()));
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()), 0, $e);
}

return $callable;
Expand Down

0 comments on commit 1a51d34

Please sign in to comment.