title: Catching Exceptions in Zend Framework 3
body: <p>I use the ZF3 skeletion application.
  I wonder where I am supposed to catch exceptions globally.</p>
  
  <p>Example:
  Right now, if I access an invalid route (mysite.com/invalid-route), the application reports an uncaught expection and HTTP response code 200</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Zend\View\Exception\RuntimeException: No RouteMatch instance provided </p>
  </blockquote>
  
  <p>I would expect the build-in 404 error page to be triggered.</p>
  
  <p>What am I missing? Can someone point me to the right direction?</p>
  
  <p>The exception is logged properly using the following code:</p>
  
  <pre><code>class Module implements ConfigProviderInterface
  {
       const VERSION = '3.0.3-dev';
  
       public function onBootstrap()
       {
           $logger = new Logger();
           $writer = new Writer\Stream(__DIR__ . '/../../../data/log/error.log');
           $logger-&gt;addWriter($writer);
  
           // Log PHP errors
           Logger::registerErrorHandler($logger, true);
  
           // Log exceptions
           Logger::registerExceptionHandler($logger);
       }
  </code></pre>