Exception chaining
monarch_dodra
monarchdodra at gmail.com
Fri Sep 13 14:14:54 PDT 2013
In one of my exception handling blocks, I call some code that
could *also*, potentially throw (it's actually a loop, where each
iteration can throw, but I have to do them *all*, meaning I need
to handle *several* extra exceptions). I'm wondering what the
"correct" way of handling both exceptions is.
We can chain them, but which comes first? Ideally, it'd be first
in, first out, but given that exceptions make a singly linked
list, pushing back is expensive (well, as expensive as it can get
in exception handling code I guess).
It's actually the amount of code I'd have to put deploy to get
the "end" of the original chain first (if it had some), then
append the exception to to the chain, update the tail etc. Seems
cumbersome.
Is there an "easy" or "built-in" way to same
"myFirstException.append(newException)"?
Is it even worth doing it? I mean, after doing all this, I
noticed that when an application dies due to an exception, it
just ignores the chained exceptions... Kind of sad.
Has anybody ever chained exceptions? Has anybody ever cared about
anything past the first exception when catching them?
More information about the Digitalmars-d-learn
mailing list