Most functions in PHP which use a resource that may fail return true/false depending on their success.
Example:
if(!include("myfile.html")) echo "the file can't be included...";
or
include("myfile.html") or do_error(); #your error function.. mabye it outputs the same message as above.