I have a CodeIgniter application that\'s generally working how I\'d like it to, but occasionally a user will go to a page that does not exist and is greeted with an unfriendly e
You should test for error return values and catch exceptions. This is a general programming concept - not something specific to Conigniter or PHP.
Testing for error return values:
if (!sort($array))
{
echo "Could not sort $array.";
}
Catching exceptions:
try
{
$someFunction($data);
}
catch (Exception $e)
{
echo "Something went wrong";
}
Of course write useful error messages with pertinent info that helps the user find their problem, and/or helps you fix your bug. You could get advanced and use something like set_error_handler(): http://php.net/manual/en/function.set-error-handler.php
I found this interesting article: http://www.derekallard.com/blog/post/error-handling-in-codeigniter/
I'm not sure it reflects the current CI release as it's from 2007.