A simple question, but he cannot find the answer.
If I have a php class, is it possible to register an exception handler for the whole class?
The reason I want to do this is because my class uses objects that are part of my domain model. These object methods raise very explicit exceptions. I do not want these exceptions to turn into classes of a higher level, but instead they wanted to catch all these exceptions and throw them as a more general exception, for example. DomainLayerException
Therefore, I would like one area in my class to detect any number of exception lists that I define from my domain model, and throw them as a more general exception, for example.
I am currently doing this by wrapping method calls on domain objects in a catch try block. This becomes very dirty as I use more and more domain objects and their methods. It would be great to remove these catch try blocks and handle them all in one place in the ie class, if any exception is thrown in the class, it is captured by one event handler defined in the class
Gaz_Edge
source share