show exception stack traces when debugging is on
authorChristian Weiske <cweiske@cweiske.de>
Wed, 11 Apr 2012 18:29:38 +0000 (20:29 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 11 Apr 2012 18:29:38 +0000 (20:29 +0200)
data/config.default.php
data/templates/exception.htm
www/www-header.php

index cec3799..804ff5e 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 $GLOBALS['phorkie']['cfg'] = array(
+    'debug'   => false,
     'gitdir'  => __DIR__ . '/../repos/git/',
     'workdir' => __DIR__ . '/../repos/work/',
     'tpl'     => __DIR__ . '/templates/',
index 99fddb9..dc07fc5 100644 (file)
@@ -10,6 +10,9 @@
    <p>
     {{exception.getMessage}}
    </p>
+   {% if debug %}
+   <pre>{{exception.getTraceAsString}}</pre>
+   {% endif %}
   </article>
  </body>
 </html>
index 77ee758..0a3b562 100644 (file)
@@ -21,7 +21,13 @@ set_exception_handler(
         } else {
             header('HTTP/1.0 500 Internal server error');
         }
-        render('exception', array('exception' => $e));
+        render(
+            'exception',
+            array(
+                'exception' => $e,
+                'debug'     => $GLOBALS['phorkie']['cfg']['debug']
+            )
+        );
         exit();
     }
 );