title: Handle global exceptions in phalcon
body: <p>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 <code>/app/public/index.html</code> to this:</p>
  
  <pre><code>&lt;?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-&gt;handle()-&gt;getContent();
  } catch (Exception $e) {
      echo 'This is where I want my handling to be';
  }
  </code></pre>
  
  <p>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?</p>