Having written a error handler class that inherits the Exception class, I am struggling what to do with unhandled exceptions.
An unhandled exception static method within the error handler class seemed a good idea with set_exception_h andler() in the construct, but this means I cannot call legally that classes methods.
Can someone suggest a better idea?
An unhandled exception static method within the error handler class seemed a good idea with set_exception_h andler() in the construct, but this means I cannot call legally that classes methods.
Can someone suggest a better idea?
Code:
class errorHandler extends Exception
{
//Constructor
function __construct($intro='')
{
//Other stuff
set_exception_handler 'errorHandler::unhandledException');
}
public function handledException()
{
//Collect error information
$this->exceptionMethods();
}
public static function unhandledException($e)
{
errorHandler::exceptionMethods(); #No can do
}
private exceptionMethods()
{
//Call various exception methods and construct error string
}
Comment