1

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

  • I just tried it on a fresh set up and it worked properly, including the 404 status code. Do you maybe have some custom error handling? – kero May 21 '15 at 13:25
  • if the way with ajax request it is doing right. I can see 404 status through chrome console and working over it with js If i need just to get the 404 message on a screen, i have this problem I use the same exception class in both cases. I get the same message in both cases, but with different status code – Roman Gasyul May 21 '15 at 14:06

0 Answers0