diff --git a/classes/DynamicPageException.class.php b/classes/DynamicPageException.class.php new file mode 100644 index 0000000..92c24fd --- /dev/null +++ b/classes/DynamicPageException.class.php @@ -0,0 +1,16 @@ + diff --git a/classes/PageController.class.php b/classes/PageController.class.php index 371ef11..2a53901 100644 --- a/classes/PageController.class.php +++ b/classes/PageController.class.php @@ -26,12 +26,18 @@ final class PageController return $decorator->display($action); } catch (MJException $e) { return $e->terminate(); - } catch (Exception $e) { + } catch (DynamicPageException $e) { $decorator_name = DEFAULT_DECORATOR; - $action_name = DEFAULT_ACTION; - $decorator = new $decorator_name; + $action_name = $e->getMessage(); + return $decorator->display(new $action_name); + } catch (StaticPageException $e) { + $decorator_name = DEFAULT_DECORATOR; + $decorator = new $decorator_name; + $action_name = DEFAULT_ACTION; return $decorator->display(new $action_name($e->getMessage())); + } catch (Exception $e) { + return $e->getMessage(); } } } diff --git a/classes/StaticPageException.class.php b/classes/StaticPageException.class.php new file mode 100644 index 0000000..4943f9f --- /dev/null +++ b/classes/StaticPageException.class.php @@ -0,0 +1,18 @@ + diff --git a/init/sys.inc.php b/init/sys.inc.php index 95d2094..aa3ed69 100644 --- a/init/sys.inc.php +++ b/init/sys.inc.php @@ -42,6 +42,7 @@ define('STATIC_TPL_PATH', TPL_PATH.'/static'); define('DECORATOR_POSTFIX', 'Decorator'); define('MODEL_POSTFIX', 'Model'); define('ACTION_POSTFIX', 'Action'); +define('EXCEPTION_POSTFIX', 'Exception'); define('TIME_NOW', time()); @@ -77,6 +78,7 @@ function __autoload($name) switch ($type) { case $name: + case EXCEPTION_POSTFIX: require(CORE_PATH.'/'.$name.'.class.php'); break; case ACTION_POSTFIX: