Rewrite standart Exception for just return error. Old functionality of showing statical pages was splitted for two new exceptions: StaticPageException for showing static templates and DynamicPageException for invoking Actions classes

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@30 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
aterekhov
2008-12-18 16:12:06 +00:00
parent 00650a83d0
commit b0094984e5
4 changed files with 45 additions and 3 deletions

View File

@ -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();
}
}
}