message = Kohana_Exception::text($e); $eo->account_id = Auth::instance()->get_user()->id; $eo->module = (Request::current()->directory() ? Request::current()->directory().'_' : '').Request::current()->controller(); $eo->method = Request::current()->action(); $eo->save(); } catch (Exception $x) { return parent::log($e,$level); } } /** * Redirect errors to the main page after showing a system message. * The error should be logged in the DB. * * @param Exception $e * @return Response */ public static function response(Exception $e) { try { if (Kohana::$config->load('debug')->show_errors) { return parent::response($e); } else { SystemMessage::add(array( 'title'=>'An Error Occured.', 'type'=>'error', 'body'=>'A error occured, which has been logged.', )); // We'll redirect to the main page. $response = Response::factory(); $response->status(302); $response->headers('Location',URL::site()); return $response; } } catch (Exception $x) { return parent::response($e); } } } ?>