Consecutive exceptions (or nested exceptions) on Delphi
Posted on 2011-05-09
I'm writing a Delphi component, all brand new code. Note that it is a component, not an application.
I don't quite understand how exceptions are handled, when they are raised at several levels of the code.
I have an Object, that owns another object, which again owns and call methos from another object.
All method code is surrounded with try..except.
Now, when I get an exception on the 3rd inner object, this also causes the 2nd object to raise another exception, and this case the 1st object to cause another exception.
If I run the code through the debugger, I see this clearly, raising 3 exceptions.
But when I run my application outside the debugger I only get one exception: the last exception in the outer object.
I see this is the most practical way, but I'm losing the error message created in the inner objects, and I only see the more generic message I have in the code.
Clearly there's something wrong either in my design or my ideas on how to implement nested exceptions.
Could you please, provide some guide on how to do this? a sample, and article to read, any thing is appreciated.