I use the following functions to set error control:
set_error_handler
set_exception_handler
When an error occurs, it calls this function which captures the errors and stores it to the database before redirect the user to a generic page
function log_error($exception)
{
if(is_object($exception))
log_action(ERROR, "Exception with message " . $exception->getMessage() . " thrown in " . $exception->getFile() . " on line " . $exception->getLine(), base_url() . $_SERVER["REQUEST_URI"]);
else
log_action(ERROR, "Unable to catch exception. print out: " . print_r($exception, true), base_url() . $_SERVER["REQUEST_URI"]);
header("Location: " . base_url() . "public_error_notification");
}
This usually works except a lot of times instead of getting an error object, I just get a number. Two numbers I get all the time are 8 and 2. You can see I account for those numbers in my error log. My question is, what do these numbers mean? When I looked it up, it made sense because there were error codes for files, but the errors I am getting now have nothing to do with files. I assume that they are error code, so is there any way that I can get a list of error codes that can be returned?
It seems you’re using the same callback for both exception handler and error handler, which do not pass the same type of arguments.
Take a look at the set_error_handler doc, the first argument is the error code, second is the error string. No object is passed
http://php.net/set_error_handler
For the error codes check this:
http://php.net/manual/en/errorfunc.constants.php