- set_error_handler: documentation ( source)
<?php
function handleError( $errno, $errstr, $errfile, $errline ) {
if ( E_RECOVERABLE_ERROR === $errno ) {
echo $errstr;
}
}
set_error_handler( 'handleError' );
try{
$g = new Generator;
} catch (Exception $e) {
$e->getMessage();
}
finally {
echo "\nTidying up loose ends ... ";
}