I was wondering, what's the best way to handle exceptions in Phalcon? I'd like to create a default error page for when an error occurs. So I rewrote /app/public/index.html
to this:
<?php
error_reporting(E_ALL);
try {
/**
* Define some useful constants
*/
define('BASE_DIR', dirname(__DIR__));
define('APP_DIR', BASE_DIR . '/app');
require_once __DIR__ . '/../vendor/autoload.php';
/**
* Read the configuration
*/
$config = include APP_DIR . '/config/config.php';
/**
* Read auto-loader
*/
include APP_DIR . '/config/loader.php';
/**
* Read services
*/
include APP_DIR . '/config/services.php';
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getContent();
} catch (Exception $e) {
echo 'This is where I want my handling to be';
}
However, when an error gets thrown, I keep getting the default Chrome 500 error window. The error is logged to OS X's error console, but I'm not seeing my echo. What am I doing wrong?