Built into PHP itself
Global handling of errors
Ability to stack error handlers
Ability to define different error handler for different error levels
<?php
function globalErrorHandler( $errno, $errstr, $errfile, $errline )
{
die( "Error $errno occurred in $errfile on line $errline: '$errstr'." );
}
set_error_handler( "globalErrorHandler" );
function writeToFile( $file, $content )
{
if ( ( $f = fopen( $file, "w" ) ) === false )
{
ErrorHandler::raiseError(
10,
"File not writeable <$file>"
);
}
}
writeToFile( "/tmp/foo", "99 ferenghi..." );
?>