Files
scummvm-web/include/ExceptionHandler.php
T
Fredrik Wendel ecbe49af28 Create a specific class for exception handling and modify relevant code parts. We can now properly detect if the MenuModel is causing the exception and therefor skip it.
Without this fix we wouldn't be able to display the exception if MenuModel was the cause since it's used in the Controller, which ExceptionsPage inherits from.

svn path=/web/trunk/; revision=40948
2009-05-27 18:24:16 +00:00

36 lines
766 B
PHP

<?php
/** Handle uncaught exceptions. */
abstract class ExceptionHandler {
static private $_exception;
/* If the MenuModel cause the exception we need to skip them. */
static public function skipMenus() {
$skip_menus = false;
$e = self::$_exception;
if (!is_null($e)) {
if (basename($e->getFile() == 'MenuModel.php')) {
$skip_menus = true;
} else {
foreach ($e->getTrace() as $t) {
if (basename($t['file']) == 'MenuModel.php') {
$skip_menus = true;
break;
}
}
}
}
return $skip_menus;
}
/* Handle exceptions. */
static public function handleException(Exception $e) {
self::$_exception = $e;
require_once('Pages/ExceptionsPage.php');
$ep = new ExceptionsPage();
return $ep->index($e);
}
}
?>