I use the following function to install my own error handler and exception handler.
set_error_handler set_exception_handler
An error handler converts errors to an exception. (throws a new exception)
But these exceptions are not caught by my own exception handler.
Error handler example:
function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { throw new Exception("this was an error"); }
An example of an exception handler:
function exceptionHandler($e){
(I think this will not work)
If it works?
Or can someone explain why it cannot work?
EDIT:
I did some tests and it should work.
The exceptions thrown in the ErrorHandler get into the ExceptionHandler. And the errors raised in the ExceptionHandler are handled by the ErrorHandler.
Just FYI.
My problem should be elsewhere
EDIT:
I still have not found why the exception thrown in my errorHandler did not fall into my Handler exception.
For example, when I have it somewhere in the code.
trigger_error("this is an error"); // gets handled by the errorHandler throw new Exception("this is an exception"); // gets handler by the exceptionHandler
The error is handled by errorHandler, but the exception raised by errorHandler is not handled by the Handler exception.
But if I throw an exception in the same place where I throw the error, this exception is handled by the exception handler.
(I hope this is somehow clear what I mean)
I am ignorant here. Any ideas I should look for a problem in?