summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-02-20 14:23:59 -0500
committerMalf Furious <m@lfurio.us>2016-02-20 14:23:59 -0500
commit79cf60764b5033edcf2962ccf3ee6d1706b41230 (patch)
treeb4d4d7aa84756c8fdd6fc603797e6174e498ef51 /app
parent032881ad889f7500cd3c4e60fcd23b2e1310d5c6 (diff)
downloadscrott-79cf60764b5033edcf2962ccf3ee6d1706b41230.tar.gz
scrott-79cf60764b5033edcf2962ccf3ee6d1706b41230.zip
Hook new Except MVC from the Root controller
This patch encapsulates all app operations in a try block, and handles any exception by passing it into the new 'Except' MVC to be displayed
Diffstat (limited to '')
-rw-r--r--app/controller/root.control.php43
1 files changed, 26 insertions, 17 deletions
diff --git a/app/controller/root.control.php b/app/controller/root.control.php
index 06abf27..2c60faf 100644
--- a/app/controller/root.control.php
+++ b/app/controller/root.control.php
@@ -2,6 +2,7 @@
require_once "class/controller.class.php";
require_once "controller/sysconf.control.php";
+require_once "controller/except.control.php";
require_once "controller/auth.control.php";
/*
@@ -15,32 +16,40 @@ class Root extends Controller
*/
function handle($argv)
{
- /* TODO -- Catch app exceptions here and display a special view to communicate them to user */
/* TODO -- Authentication (login / logout / register) MVC */
$argv = $this->normalizeArgv($argv);
- /* First, make sure the system configuration file has been included */
- if (!$this->scrottConfExists())
+ try
{
- $ctrl = new Sysconf();
- $ctrl->handle($argv);
- }
+ /* First, make sure the system configuration file has been included */
+ if (!$this->scrottConfExists())
+ {
+ $ctrl = new Sysconf();
+ $ctrl->handle($argv);
+ }
- /* TODO */
- /* TODO -- only auth if logged out */
- else if (!$this->getCurrentUser())
- {
- $ctrl = new Auth();
- $ctrl->handle($argv);
+ /* TODO */
+ /* TODO -- only auth if logged out */
+ else if (!$this->getCurrentUser())
+ {
+ $ctrl = new Auth();
+ $ctrl->handle($argv);
+ }
+
+ else
+ {
+ echo "logged in as:!";
+ echo "<pre>";
+ var_dump($this->getCurrentUser());
+ echo "</pre>";
+ }
}
- else
+ catch (Exception $e)
{
- echo "logged in as:!";
- echo "<pre>";
- var_dump($this->getCurrentUser());
- echo "</pre>";
+ $ctrl = new Except();
+ $ctrl->handle($e->getMessage());
}
}