/** * Handle exception * * @param Exception $e */ public static function handle(Exception $e) { if ($e instanceof Kohana_404_Exception) { if (Kohana::config('site.inviteonly') && !Visitor::instance()->get_user()) { // Redirect to invite login if invite only and not logged in url::redirect('invite'); } else { if (!headers_sent()) { $e->sendHeaders(); } $page = new Error_Controller(); $page->_404(); } } else { return parent::handle($e); } }
public static function handle(Exception $e) { if ($e instanceof ORM_Validation_Exception) { Kohana_Log::add("error", "Validation errors: " . print_r($e->validation->errors(), 1)); } try { $user = identity::active_user(); $try_themed_view = $user && !$user->admin; } catch (Exception $e2) { $try_themed_view = false; } if ($try_themed_view) { try { return self::_show_themed_error_page($e); } catch (Exception $e3) { Kohana_Log::add("error", "Exception in exception handling code: " . self::text($e3)); return parent::handle($e); } } else { return parent::handle($e); } }