{ Error Reporting With FirePHP }

Assuming you have FireBug installed, and FirePHP set up, you can use FirePHP to handle your errors. This is pretty sweet, because you can actually see your error messages without barfing them out to the screen. Which is all kinds of bad.

Put this somewhere in your code so that it gets executed early.

// this is going to take any errors and write them to FirePHP instead
function myErrorHandler($errno, $errstr, $errfile, $errline) {

	$errmsg = $errstr . ' in ' . $errfile . ' line #' . $errline;

	switch ($errno) {
    	case E_USER_ERROR:
		fb('FATAL ERROR: ' . $errmsg, FirePHP::ERROR);
    		exit(1);
	        break;

	    case E_USER_WARNING:
		fb('WARNING: ' . $errmsg, FirePHP::WARN);
	        break;
	
	    case E_USER_NOTICE:
		fb('Notice: ' . $errmsg, FirePHP::INFO);
	        break;
	
	    default:
#	    	fb($errmsg);
	        break;
    }

    /* Don't execute PHP internal error handler */
    return true;	

}
error_reporting(E_ALL);
set_error_handler('myErrorHandler');

Leave a Reply

Your email address will not be published. Required fields are marked *