10use Phalcon\DI\Exception;
 
   23            $di = DI::getDefault();
 
   27        $di->setShared(
'whoops.pretty_page_handler', 
function () {
 
   32        $di->setShared(
'whoops.json_response_handler', 
function () {
 
   34            $jsonHandler->onlyForAjaxRequests(
true);
 
   43        $phalcon_info_handler = 
function () use ($di) {
 
   45                $request = $di[
'request'];
 
   46            } 
catch (Exception $e) {
 
   53            $di[
'whoops.pretty_page_handler']->addDataTable(
'Phalcon Application (Request)', array(
 
   54                'URI'         => $request->getScheme().
'://'.$request->getServer(
'HTTP_HOST').$request->getServer(
'REQUEST_URI'),
 
   55                'Request URI' => $request->getServer(
'REQUEST_URI'),
 
   56                'Path Info'   => $request->getServer(
'PATH_INFO'),
 
   57                'Query String' => $request->getServer(
'QUERY_STRING') ?: 
'<none>',
 
   58                'HTTP Method' => $request->getMethod(),
 
   59                'Script Name' => $request->getServer(
'SCRIPT_NAME'),
 
   62                'Scheme'      => $request->getScheme(),
 
   63                'Port'        => $request->getServer(
'SERVER_PORT'),
 
   64                'Host'        => $request->getServerName(),
 
   68        $di->setShared(
'whoops', 
function () use ($di,$phalcon_info_handler) {
 
   70            $run->pushHandler($di[
'whoops.pretty_page_handler']);
 
   71            $run->pushHandler($phalcon_info_handler);
 
   72            $run->pushHandler($di[
'whoops.json_response_handler']);
 
   76        $di[
'whoops']->register();
 
Catches an exception and converts it to a JSON response.
 
Whoops - php errors for cool kids.