问题描述:

I use kohana 3.3 for my web-site and i got this issue.

Somewhere in the code i'm throwing custom exception like HTTP_Exception_404

$article = ORM::factory('article',array('url' => $url));

if(!$article->loaded()){

throw new HTTP_Exception_404('Метод showPage в контроллере статьи');

return;

}

and i wanna see 404 page and i see 404 page, but it has 200 Ok status.


Whats wrong with me?

Below the code of exception's class

class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {

public function get_response(){

$view = View::factory('errors/404');

$view->message = $this->getMessage();

$response = Response::factory()

->status(404)

->body($view->render());

return $response;

}

}

If this exception called in duration ajax request it's doing right and i'am getting message with 404 code, but if it is a common request i'm getting the same message only with 200 code

相关阅读:
Top