Code: Select all
if (exception_->exceptions != (void *) NULL)
{
index=GetNumberOfElementsInLinkedList((LinkedListInfo *)
exception_->exceptions);
while(index > 0)
{
p=(const ExceptionInfo *) GetValueFromLinkedList((LinkedListInfo *)
exception_->exceptions,--index);
if ((p->severity != exception_->severity) || (LocaleCompare(p->reason,
exception_->reason) != 0) || (LocaleCompare(p->description,
exception_->description) != 0))
{
if (nestedException == (Exception *) NULL)
nestedException=createException(p); // root exception created
else
{
q=createException(p);
nestedException->nested(q);
nestedException=q; // leaf exception overwrites previous root/leaf value...what happens to that pointer?
}
}
}
}
...
throw XXX(message,nestedException); // leaf exception is passed to exception ctor, so only that leaf exception gets deleted on exception dtor
Perhaps the resulting Exception object should be based on the first/root nestedException rather than the last/leaf exception?