CodeIgniter Forums

Full Version: Extending CI_Exceptions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 {

    protected $CI;

   public function __construct()
       $this->CI =& get_instance();
Thanks in advance,
As mentionend previously, I tried this method.
The error output : Fatal error: Call to a member function library() on a non-object in
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(...)
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 ?
Any news ?
CI is not yet loaded so you will get an Error.

See CodeIgniter.php to see how it is loading things.