Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Pipe through render and report exception methods #36032

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

driesvints
Copy link
Member

This PR fixes a bug where the report or render methods of an exception that were thrown in a view aren't being called by Laravel's exception handler. The reason for this is that these kind of view exceptions are wrapped in an ErrorException instance by Laravel here:

$e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e);

Because there's no render or report method on an ErrorException instance the original ones aren't executed. I've solved this by introducing a new ViewException class that extends ErrorException and pipes through any render or report calls that are present on the previous exception instance. This should be non-breaking.

Fixes #35493

@taylorotwell taylorotwell merged commit b7c6055 into 8.x Jan 25, 2021
@taylorotwell taylorotwell deleted the view-exception branch January 25, 2021 15:29
taylorotwell pushed a commit that referenced this pull request Jan 25, 2021
…36037)

* Pipe through render and report exception methods (#36032)

* Fix method_exists call

* Re-add facade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renderable exceptions inside views
2 participants