Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed EOL

  • Loading branch information...
commit 042e96bc036e2e8bcb8b0c4170ec1e3b579400fc 1 parent 232ee6f
@drpheltright authored
Showing with 38 additions and 1 deletion.
  1. +38 −1 classes/prophet/exception.php
View
39 classes/prophet/exception.php
@@ -1 +1,38 @@
-<?php defined('SYSPATH') or die('No direct script access.');
+<?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;
+ }
+ }
+
+}

0 comments on commit 042e96b

Please sign in to comment.
Something went wrong with that request. Please try again.