dostałem w spadku aplikację napisaną w 3.1 i polecenie upgrade do 3.3. A więc zajrzawszy do dokumentacji wszystko w miarę wyszło oprócz błędów, które chciałbym aby się wyświetłały jako 404 w template. Zgodnie z dokumentacją napisałem:
class HTTP_Exception extends Kohana_HTTP_Exception { /** * Generate a Response for all Exceptions without a more specific override * * The user should see a nice error page, however, if we are in development * mode we should show the normal Kohana error page. * * @return Response */ public function get_response() { // Lets log the Exception, Just in case it's important! Kohana_Exception::log($this); if (Kohana::$environment >= Kohana::DEVELOPMENT) { // Show the normal Kohana error page. return parent::get_response(); } else { // Generate a nicer looking "Oops" page. $view = View::factory('errors/404'); $response = Response::factory() ->status($this->getCode()) ->body($view->render()); return $response; } } }
No i to wyświetla widok errors/404 a ja chcę żeby ten widok szedł przez template (czyli żeby był wywoływany kontroler errors/404). Było tak, ale to nie działa w 3.3:
class Kohana_Exception extends Kohana_Kohana_Exception { { try { // Throw errors when in development mode if (Kohana::$environment=== Kohana::DEVELOPMENT) { parent::handler($e); } else { Kohana::$log->add(Log::ERROR, Kohana_Exception::text($e)); 'action' => 500, ); if ($e instanceof Http_Exception) { $attributes['action'] = $e->getCode(); } // Error sub request ->execute() ->send_headers() ->body(); } } catch (Exception $e) { } } }
W google nie mogę znaleźć czegoś co pozwalałoby mi to pojąć a oficjalne forum leży..
Dzięki