Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed error/exception handling from Prophet

  • Loading branch information...
commit 9eefd3e83b7057be92515b053d5aa82567d036d4 1 parent 042e96b
@DrPheltRight authored
View
21 README.markdown
@@ -3,7 +3,6 @@
What can Prophet do for you?
* Automatic view loading ([Kostache][], [Kohana Views][], etc.)
-* Error handling 404, 500 (inspired by [Errorist][])
[Kostache]: https://github.com/zombor/KOstache
[Kohana Views]: http://kohanaframework.org/guide/kohana/mvc/views
@@ -137,26 +136,6 @@ you need to.
protected $_view = FALSE;
}
-
-## Error Handling
-
-When an action or controller cannot be found
-Controller_Error::action_404 will be served instead. You can
-customise the behaviour of this action by extending
-Prophet_Controller_Error.
-
-All other errors will be served as 500 and therefore
-Controller_Error::action_500 will be used to serve a response.
-
-You can also throw a Http_Exception for any status code,
-although only 404 and 500 errors have an action defined.
-
-You don't have to extend Prophet_Controller_Error to customise
-the error response however. You can simply make your own custom
-view. "views/error/404.php" and "views/error/500.php" will
-be loaded by default. You can replace these files in your
-application if you wish to without needing to update any
-controllers.
## License
View
1  classes/controller/error.php
@@ -1 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
View
26 classes/prophet/controller/error.php
@@ -1,26 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-class Prophet_Controller_Error extends Controller {
-
- public function before()
- {
- // External requests default to 404
- if ($this->request->is_initial())
- {
- $this->request->action(404);
- }
-
- return parent::before();
- }
-
- public function action_404()
- {
- $this->response->status(404);
- }
-
- public function action_500()
- {
- $this->response->status(500);
- }
-
-}
View
38 classes/prophet/exception.php
@@ -1,38 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-class Prophet_Exception {
-
- public static function handler(Exception $e)
- {
- if (Kohana::$environment === Kohana::DEVELOPMENT)
- {
- Kohana_Exception::handler($e);
- }
-
- // It's a nice time to log :)
- Kohana::$log->add(Kohana_Log::ERROR, Kohana_Exception::text($e));
-
- if ( ! defined('SUPPRESS_REQUEST'))
- {
- $request = array(
- // Get status from current request
- 'action' => Request::current()->status(),
-
- // If exception has a message this can be passed on
- 'message' => rawurlencode($e->getMessage()),
- );
-
- // Override status if HTTP_Exception thrown
- if ($e instanceof HTTP_Exception)
- {
- $request['action'] = $e->getCode();
- }
-
- echo Request::factory(Route::get('prophet_error')->uri($request))
- ->execute()
- ->send_headers()
- ->response;
- }
- }
-
-}
View
20 init.php
@@ -1,20 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-if (Kohana::$errors)
-{
- // Override Kohana exception handler
- set_exception_handler(array('prophet', 'exception_handler'));
-}
-
-// Error Route for internal error requests
-Route::set('prophet_error', 'prophet_error/<action>(/<message>)', array('action' => '[0-9]{3}', 'message' => '.*'))
- ->defaults(array(
- 'controller' => 'error',
- ));
-
-// Catch All Route (404 Response)
-Route::set('prophet_catchall', '<catchall>', array('catchall' => '.*'))
- ->defaults(array(
- 'controller' => 'error',
- 'action' => '404',
- ));
View
1  views/error/404.php
@@ -1 +0,0 @@
-404 Page Not Found
View
1  views/error/500.php
@@ -1 +0,0 @@
-500 An Error Occured
Please sign in to comment.
Something went wrong with that request. Please try again.