php - How to throw custom exceptions in codeigniter? -


i want know how throw custom exception messages in codeigniter when situations following happen:

  1. connection database failed reason(i intentionally gave non-existent database name in application/config/database.php file test , tried try-catch on $this->db->get() did not work. codeigniter gave own error message)

2.a method fails execute. tried ::

try {   $this->model_name->myfunc();//myfunc non-existent method other reason failure should handled using custom message }catch(exception $e) {    echo "method failed run"; } 

this did not worked too

there many kind of exceptions, maybe you'll need catch example mysqli_sql_exception

      try{        // code connect db      }catch(mysqli_sql_exception $e)      {         return 'custom message';      } 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo