laravel/framework — pull request #2097 by sebastion (2013-08-14 06:14:19+00:00)
Title: Throw ErrorException so developers can catch it.

This is a far more elegant solution than #1959 which addresses the problem in #1807.

Simply return a derivative of an Exception from the custom error handler and it will be thrown.

This is particularly useful if I want to allow this:

```php
try {
$throwsPhpError = 2 / 0;
}
catch (\ErrorException $ex) {
// Do nothing
}
```

Possible by defining
```php
App::error(function(\ErrorException $exception, $code)
{
return $exception;
});
```

It's simple. It's clean. And it works!