Observing exceptions in a destructor
Mark Isaacson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 21 20:45:33 PDT 2015
Oh well :(.
Yeah, it's just for debugging. I want to publish a script that
automatically gathers relevant debug information so that my users
can just copy paste it all into one place, ready for me to take a
look even if I can't repro. One of the primitives in my script is
a wrapper around std.process that caches the result, and I wanted
to make it so that if the program throws an exception while one
of the CacheResult objects is in scope, it dumps its contents out
to a pastebin and logs the URL.
I ended up manually adding some scope (failure)s at the call
sites and putting the relevant code in a member function... but
it would have been nice to not need to duplicate the scope
(failure)s and have it simply live in the destructor.
More information about the Digitalmars-d-learn