title: Create custom exception class for codeigniter
body: <p>I'm trying to create custom exception class for codeigniter. Here is my code:</p>
  
  <pre><code>class Ci_exception extends Exception {
  
      var $CI;
  
      function __construct()
      {
          $this-&gt;CI =&amp; get_instance();
      }
  
      public function errorMessage()
      {
          log_message('error', $this-&gt;getMessage());
          return $this-&gt;getMessage();
      }
  
  }
  </code></pre>
  
  <p>This custom class works fine if there is no constructor method. With the construct method the $this->getMessage() method doesn't return any message. Can anyone explain why?</p>