summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-09 07:25:35 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-02-09 07:25:35 -0500
commit5466f6a6d0950331a4cb54e09b44ea4524751fb4 (patch)
tree6bcbafb19e7d1713ee374ddc6308b89bb74e0f7d /index.php
parentaa06d760b375c0cc9bbc693bf4bd412e9fda8f50 (diff)
Better exception handling in index
Some better exception handling in Web entry point.
Diffstat (limited to 'index.php')
-rw-r--r--index.php26
1 files changed, 11 insertions, 15 deletions
diff --git a/index.php b/index.php
index 075ee9676..dac5a8071 100644
--- a/index.php
+++ b/index.php
@@ -48,9 +48,8 @@ if (!$user && common_config('site', 'private') &&
$actionfile = INSTALLDIR."/actions/$action.php";
if (!file_exists($actionfile)) {
- $cac = new ClientErrorAction();
- $cac->handle(array('code' => 404,
- 'message' => _('Unknown action')));
+ $cac = new ClientErrorAction(_('Unknown action'), 404);
+ $cac->showPage();
} else {
include_once $actionfile;
@@ -75,17 +74,14 @@ if (!file_exists($actionfile)) {
if ($action_obj->prepare($_REQUEST)) {
$action_obj->handle($_REQUEST);
}
- } catch (ClientException cex) {
- $cac = new ClientErrorAction();
- $cac->handle(array('code' => $cex->code,
- 'message' => $cex->message));
- } catch (ServerException sex) { // snort snort guffaw
- $sac = new ServerErrorAction();
- $sac->handle(array('code' => $sex->code,
- 'message' => $sex->message));
- } catch (Exception ex) {
- $sac = new ServerErrorAction();
- $sac->handle(array('code' => 500,
- 'message' => $ex->message));
+ } catch (ClientException $cex) {
+ $cac = new ClientErrorAction($cex->getMessage(), $cex->getCode());
+ $cac->showPage();
+ } catch (ServerException $sex) { // snort snort guffaw
+ $sac = new ServerErrorAction($sex->getMessage(), $sex->getCode());
+ $sac->showPage();
+ } catch (Exception $ex) {
+ $sac = new ServerErrorAction($ex->getMessage());
+ $sac->showPage();
}
}