Updates to 404 handling
authorMatthew Weier O'Phinney <matthew@zend.com>
Tue, 28 Feb 2012 18:06:10 +0000 (12:06 -0600)
committerMatthew Weier O'Phinney <matthew@zend.com>
Tue, 28 Feb 2012 18:06:10 +0000 (12:06 -0600)
- Updated configuration settings
- Updated 404 handler to display controller and exception, if present
- Do not merge until all outstanding view layer PRs are merged on ZF2
  master

module/Application/config/module.config.php
module/Application/view/error/404.phtml

index dd2f0d7..fd748ee 100644 (file)
@@ -54,19 +54,20 @@ return array(
             ),
             'Zend\Mvc\View\DefaultRenderingStrategy' => array(
                 'parameters' => array(
-                    'baseTemplate' => 'layout/layout',
+                    'layoutTemplate' => 'layout/layout',
                 ),
             ),
             'Zend\Mvc\View\ExceptionStrategy' => array(
                 'parameters' => array(
                     'displayExceptions' => true,
-                    'template'          => 'error/index',
+                    'exceptionTemplate' => 'error/index',
                 ),
             ),
             'Zend\Mvc\View\RouteNotFoundStrategy' => array(
                 'parameters' => array(
-                    'notFoundTemplate' => 'error/404',
                     'displayNotFoundReason' => true,
+                    'displayExceptions'     => true,
+                    'notFoundTemplate'      => 'error/404',
                 ),
             ),
 
index aa5771d..468953f 100644 (file)
@@ -26,8 +26,35 @@ switch ($this->reason) {
 
 <p><?php echo $reasonMessage ?></p>
 
-<?php else: ?>
+<?php endif ?>
+
+<?php if (isset($this->controller) && $this->controller): ?>
+
+<dl>
+    <dt>Controller:</dt>
+    <dd><?php $this->escape($this->controller) ?>
+<?php
+if (isset($this->controller_class) 
+    && $this->controller_class
+    && $this->controller_class != $this->controller
+) {
+    echo " (resolves to " . $this->escape($this->controller_class) . ")";
+}
+?>
+</dd>
+
+<?php endif ?>
+
+<?php if (isset($this->exception) && $this->exception): ?>
+
+<h2>Exception:</h2>
+
+<p><b><?php echo $this->escape($this->exception->getMessage()) ?></b></p>
+
+<h3>Stack trace</h3>
 
-<h3>No Exception available</h3>
+<pre>
+<?php echo $this->exception->getTraceAsString() ?>
+</pre>
 
 <?php endif ?>