. . .no. . . more. . . code. Lol
Error handling is exceedingly easy to perform. Since you have specific criteria, that is what I would suggest passing to the trigger.
function errorHandler($errno, $errstr, $errfile, $errline)
$_SESSION['resultsCode'] = $errstr;
// email or whatever. I'd die here
header('Location: ' . ERROR_LOCATION);
set_error_handler('errorHandler', E_USER_NOTICE | E_USER_WARNING | E_USER_FATAL);
Now you simply define ERROR_LOCATION on a script by script basis, and when triggered the error handler will assign the given value to the session, and redirect to the location under ERROR_LOCATION.
You are bound by only using the three error levels on a trigger. Technically you could take an E_USER_NOTICE level and assign results this way and modify the error handler to react accordingly. Personally I wouldn't do that, I'd just continue processing per normal for good runs, and present the error handler with failures only. I'd suggest that E_USER_FATAL is the only one you need to do something like issue an email, but the others may want to have a logging feature in place or whatever.