Error Handling Notes

Error messaging facility:


$errL = new ErrorListener();

global $errL;
...
$errL->add('context', 'message', $errCode);
...

if ($errL->hasErrors())
$errL->showAsHtml();

$errL->getError('context');

if ($errL->hasError('context'))
exit;

The listener would collect all error messages into an object, and provide methods to help display them.

It can also dispatch code:

$errL->addHandlerObject('context', &$objRef );

If an error is triggered with the key 'context', $objRef->errorHandler($errCode) is called.

Shortly after I wrote this note, a class at PHP Classes showed up that does something related: error_manager