Extending CI_Exceptions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Extending CI_Exceptions (/showthread.php?tid=66715) |
Extending CI_Exceptions - Auk - 11-24-2016 Hello, I'm trying to extend CI_Exceptions but I can't access the load method in my sub class. I tried : PHP Code: class MY_Exceptions extends CI_Exceptions { RE: Extending CI_Exceptions - ciadmin - 11-24-2016 This might help ... http://www.codeigniter.com/user_guide/general/ancillary_classes.html?highlight=instance#get-instance RE: Extending CI_Exceptions - Auk - 11-24-2016 As mentionend previously, I tried this method. The error output : Fatal error: Call to a member function library() on a non-object in RE: Extending CI_Exceptions - ciadmin - 11-24-2016 Sorry - I was looking at your original github issue, where you had $this->load... If still getting an undefined property, that suggests to me that the CI instance is not fully constructed when the Exceptions class is loaded, and that you might have to reference CI etc in one of the work methods, eg log_exception(...) RE: Extending CI_Exceptions - Auk - 11-24-2016 I tried to use $this->_CI->load->library('twig'); in the show_error method without success. Error output : Message: Trying to get property of non-object. BTW I extended the Loader class and could not load a library in the constructor. However, it worked in the methods. I guess CI_Loader is instantiated before CI_Exceptions. What could be a good solution to my problem ? RE: Extending CI_Exceptions - Auk - 11-26-2016 Any news ? RE: Extending CI_Exceptions - InsiteFX - 11-26-2016 CI is not yet loaded so you will get an Error. See CodeIgniter.php to see how it is loading things. |