php - objects throwing exceptions inside of objects -


I am working on an object that instantates another object at some point. That internal object can throw an exception. I can give the exception bubble to whatever code the parent handles, which I want to do, only after the appearance of KISS. Or, I can do some exception within the parent object, and possibly the 'client' code gives a more meaningful exception. Is there any general rule to follow or do I decide what to do on a case-by-case basis?

With the child object, I took the time to write an error code, in the future I could give end-users more meaningful error messages. If the object of the parent and the child's object has their own error codes, how can I handle it? It seems that I will write an exception handler which looks at the error code and its origins class, okay?

If the "external" object can not handle the exceptions thrown by the "inner" object, then it Should not try to do the best, it can catch some of the more common people and restore a bit more information attached.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -