I've been using Exception handling as a means to centralize my logging of errors into a database table for my application. I've used set_exception_handler() to route exceptions to a function which logs this information and continues after the error silently so as not to present the user with errors. This has been especially helpful in debugging because I can send messages to the db table simply by issuing:
throw new Exception("My message I want to check in the db table");
and check the db table to debug rather than the local log file. In essence - my goal is to replace the error_log() function capability alleviating the need to search to local webserver log files in a multi-server load-balanced situation.
It has been working great for me until I started writing Class files and doing the same thing - that is - using similar throw statements to pass information back. When I try to do this in a function within a class, the code execution does not continue past the throw statement back to the calling code where the class was instantiated. Code execution literally stops, silently, after logging the exception to the db table. I want the code to continue to execute after logging.
Is this some documented behavior in php that I'm not aware of? How can I change this or set up my class files so they behave like the rest of the application code?
Thanks in advance!