laravel/framework — pull request #4073 by anlutro (2014-04-08 07:39:44+00:00)
Title: Make exception handler comply with HttpKernelInterface

Removed `Handler::sendResponse`. In the case of `Application::handle`'s try/catch block catching an exception, the Response object should be returned, not sent immediately, in order to comply to the HttpKernelInterface.

This may also fix the long standing bug where `App::after` / `App::shutdown` callbacks not firing for error responses.

Added `handleUncaughtException` which *does* send the response, in case of uncaught exceptions (that is, exceptions that occur outside of any try/catch block such as the one found in `Application::handle`.

My use case for this is that I need to write some tests for a package that rely on the exception handler functioning properly. Currently, if an exception is caught by `Application::run` and the environment is "testing", the exception will just be re-thrown, but if I se the environment to something else, the response is sent and floods the terminal with HTML.