Permalink
Browse files

Renamed Controller_Prophet to Controller_Error to make the function o…

…f the controller more apparent
  • Loading branch information...
1 parent c04c061 commit f752be9c92aa7a3e57d73200a77cc7f28d842bf6 @lukemorton committed Dec 30, 2010
Showing with 30 additions and 3 deletions.
  1. +1 −0 classes/controller/error.php
  2. +26 −0 classes/prophet/controller/error.php
  3. +3 −3 init.php
@@ -0,0 +1 @@
+<?php defined('SYSPATH') or die('No direct script access.');class Controller_Error extends Prophet_Controller_Error {}
@@ -0,0 +1,26 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+class Prophet_Controller_Error extends Controller {
+
+ public function before()
+ {
+ // External requests default to 500
+ if (Request::$instance === Request::$current)
+ {
+ $this->request->action = 500;
+ }
+
+ return parent::before();
+ }
+
+ public function action_404()
+ {
+ $this->request->code = 404;
+ }
+
+ public function action_500()
+ {
+ $this->request->code = 500;
+ }
+
+}
View
@@ -3,19 +3,19 @@
if (Kohana::$errors)
{
// Override Kohana exception handler
- set_exception_handler(array('prophet', 'exception_handler'));
+ //set_exception_handler(array('prophet', 'exception_handler'));
}
// Error Route for internal error requests
Route::set('prophet_error', '<action>(/<message>)', array('action' => '[0-9]{3}', 'message' => '.*'))
->defaults(array(
- 'controller' => 'prophet'
+ 'controller' => 'error'
));
// Catch All Route (404 Response)
Route::set('prophet_catchall', '<catchall>', array('catchall' => '.*'))
->defaults(array(
- 'controller' => 'prophet',
+ 'controller' => 'error',
'action' => '404',
));

0 comments on commit f752be9

Please sign in to comment.