• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extending CI_Exceptions

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,

This might help ... http://www.codeigniter.com/user_guide/ge...t-instance

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.