Jump to content
php.lv forumi

Kohana error handling

php newbie

Recommended Posts

taisu pēc tutoriala fiendly error pages: http://kohanaframework.org/3.2/guide/kohana/tutorials/error-pages

extendoju Kohana_Exception klasi nokopejot kodu no tutoriala. Tur ir viena metode handle.

testēju ar 2 kļūdam: Kohana_Exception un Kohana_HTTP_Exception (404).

1. Tā metode vispār netiek izsaukta kad izmet tas kļūdas
2. Kad izmet  Kohana_Exception, tiek izsaukts _handle 

3. Kad izmet Kohana_HTTP_Exception netiek izsaukts ne handle, ne _handle.

wtf? neko nesaprotu vispār.

laikam būs vienkārši error view jāparraksta...

Link to comment
Share on other sites

Ok kad sapratu ka skatos nepareizas versijas dokumentāciju tad laikam aizgāja, bet vienalga dokumentācija nav pilnīga.

Visiem HTTP exceptioniep pārrakstam application\classes\HTTP\Exception.php

<?php defined('SYSPATH') OR die('No direct script access.');

class HTTP_Exception extends Kohana_HTTP_Exception {
    public function get_response()
        // Lets log the Exception, Just in case it's important!
        if (Kohana::$environment >= Kohana::DEVELOPMENT)
            // Show the normal Kohana error page.
            return parent::get_response();
            $view = View::factory('error/http');
            $response = Response::factory()
            return $response;


Visiem parējiem exceptioniem application\classes\Kohana\Exception.php:


Vai nu visvienkāršakais variants pārrakstīt application\views\kohana\error.php


Edited by php newbie
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...