<?xml version="1.0" encoding="UTF-8"?><item><title>Catch(...) and rethrow</title><description>&lt;p&gt;&lt;a href="http://www.nedbatchelder.com/blog/200310.html"&gt;Ned Batchelder&lt;/a&gt; said that he didn't approve of the catch(...) but I think it's necessary in this particular instance.  This is because when the UpdateRegistry method fails &lt;em&gt;for any reason&lt;/em&gt;, the CopyFiles must be undone.&lt;/p&gt;&#13;
&lt;p&gt;What I missed is re-throwing the exception after fixing the stuff I knew I had to fix:&lt;/p&gt;&#13;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;    } catch (...)&lt;br /&gt;    {&lt;br /&gt;        UnCopyFiles();&lt;br /&gt;        UnUpdateRegistry();&lt;br /&gt;        throw;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;    }&lt;/font&gt;&lt;/p&gt;&#13;
&lt;p&gt;If there are other specific error conditions that you can handle and eat (de-escalating them from exceptions to return codes) then you'd want to do that in a separate catch block.&lt;/p&gt;&#13;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;/font&gt; &lt;/p&gt;</description><pubDate>Thu, 01 Sep 2005 19:17:04 GMT</pubDate></item>