public static function on_exception_rescue(RescueExceptionEvent $event) { $event->chain(function (RescueExceptionEvent $event, $target) { if ($event->response) { return; } try { $sunshine = new ExceptionSunshine($target); $html = \ICanBoogie\app()->render($sunshine, ['layout' => '@exception']); $event->response = new Response($html, $sunshine->http_code, ['X-Exception-Origin' => $sunshine->file]); } catch (\Exception $e) { } }); }