<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx</link><description>Exception Throwing Exception throwing guidelines described in this section require a good definition of the meaning of execution failure. Execution failure occurs whenever a member cannot do what it was designed to do (what the member name implies). For</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to get .NET Framework Design Guidelines Updates [Krzysztof Cwalina]</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#396796</link><pubDate>Wed, 16 Mar 2005 17:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396796</guid><dc:creator>BCLTeam's WebLog</dc:creator><description /></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#396804</link><pubDate>Wed, 16 Mar 2005 19:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396804</guid><dc:creator>Rolando</dc:creator><description>&amp;amp;quot;Do not create and throw new exceptions just to have ‘your team's’ exception.&amp;amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;I was planning to do exactly that so we can identify exceptions thrown by our own code.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Could you explain why this is a bad idea ?&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;thanks.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#396852</link><pubDate>Wed, 16 Mar 2005 19:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396852</guid><dc:creator>damien morton</dc:creator><description>Python uses what is called the &amp;quot;samurai principle&amp;quot; for determining when to throw exceptions:&lt;br&gt;&lt;br&gt;Return a meaningfull and useable result or else throw an exception.&lt;br&gt;&lt;br&gt;I find that the standard prescription &amp;quot;exceptions are for exceptional circumstances&amp;quot; doesnt give much guidance, and welcome these new guidelines.</description></item><item><title>Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#396909</link><pubDate>Wed, 16 Mar 2005 19:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396909</guid><dc:creator>Richard Murillo's Blog</dc:creator><description /></item><item><title>Guidelines para o uso de excep</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#396935</link><pubDate>Wed, 16 Mar 2005 20:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396935</guid><dc:creator>LA.Net </dc:creator><description /></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#397125</link><pubDate>Thu, 17 Mar 2005 01:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:397125</guid><dc:creator>Jacques Troux</dc:creator><description>&amp;quot;Do not return error codes. Exceptions are the primary means of reporting errors in frameworks.&amp;quot;&lt;br&gt; &lt;br&gt;Blech. One more reason for me to stay away from .net.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#397384</link><pubDate>Thu, 17 Mar 2005 13:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:397384</guid><dc:creator>Jeroen Frijters</dc:creator><description>So what do you make of Thread.Abort() that (on Whidbey, if the thread is suspended) throws an exception *and* schedules an abort?</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#397455</link><pubDate>Thu, 17 Mar 2005 16:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:397455</guid><dc:creator>mihailik</dc:creator><description>Question on AgumentNullException.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;What exception to throw if my method does not allow &amp;amp;quot;&amp;amp;quot; (empty string) and such argument was passed in?&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;In some place of CLR I have seen ArgumentNullException, but String.Empty is definitely not null. What is the guideline here?&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Please claim this option to official document, that all developers have to deal same way.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#397457</link><pubDate>Thu, 17 Mar 2005 16:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:397457</guid><dc:creator>Rolando</dc:creator><description>&amp;amp;quot;Do not create and throw new exceptions just to have ‘your team's’ exception.&amp;amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Could you explain why ?&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;We were planning to do this so we can identify the exceptions thrown by our code.&amp;lt;br&amp;gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#397458</link><pubDate>Thu, 17 Mar 2005 16:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:397458</guid><dc:creator>mihailik</dc:creator><description>Jacques Troux: it is phylosophical discussion. Miguel de Icaza — leader of Mono, a.k.a. .NET for Linux — Miguel votes for error codes in some of his old messages. And you can find the interview with Anders Heilsberg — author of C# — that expressively votes for exceptions.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;All .NET ideology built with exceptions, and it is extrmely important for security and stability.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#398147</link><pubDate>Thu, 17 Mar 2005 23:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:398147</guid><dc:creator>Joe Duffy</dc:creator><description>Jeroen, you're correct about the behavior.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;I wouldn't recommend following the pattern that Thread.Abort() uses. (Note: I wouldn't recommend suspending and asynchronously aborting threads either, but that's a wildly separate topic. :))&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The behavior is strange. It succeeds at provoking an abort, but does throw an exception.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;I wish we could change it, but it's been that way since 1.0.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#398426</link><pubDate>Fri, 18 Mar 2005 08:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:398426</guid><dc:creator>David M. Kean</dc:creator><description>What does FailFast do? I can't find any documentation on it.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#398680</link><pubDate>Fri, 18 Mar 2005 20:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:398680</guid><dc:creator>Jeffrey Sax</dc:creator><description>This guideline is mostly excellent, but confusing in one respect.&lt;br&gt;&lt;br&gt;This performance rule:&lt;br&gt;&lt;br&gt;&amp;quot;Do not use error codes because of concerns that exceptions might affect performance negatively.&amp;quot;&lt;br&gt;&lt;br&gt;is violated by the TryParse pattern. The TryParse pattern is worded nicely, but still clearly uses an error code to indicate success or failure.&lt;br&gt;&lt;br&gt;This contradiction, and the confusion that comes with it, disappear if you qualify the first rule with &amp;quot;except in extremely performance demanding APIs,&amp;quot; and then suggest to &amp;quot;Do use&amp;quot; the TryParse pattern for these situations.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#398710</link><pubDate>Fri, 18 Mar 2005 20:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:398710</guid><dc:creator>Jonathan Keljo [MS]</dc:creator><description>System.Environment.FailFast offers the user a chance to send an error report, then terminates the process. (It's the nicer managed equivalent to calling ExitProcess when you decide you really can't go on.) If you're writing a class library you probably don't want to use FailFast--at least not if you like having customers :-D. If you're writing an application, though, it often makes sense if you really want the process to die. Exceptions can be caught; FailFast just kills the process right away.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#398761</link><pubDate>Fri, 18 Mar 2005 22:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:398761</guid><dc:creator>Jonathan Keljo [MS]</dc:creator><description>Here's how I think about the performance rule and Parse vs. TryParse:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Parse says it’s going to parse something. “Failure” means it couldn’t parse it. So exceptions from Parse could include exceptions because what you passed to it wasn’t parseable. The return value is the result of the operation—the parsed value.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;TryParse says it’s going to try to parse something. “Failure” means that it wasn’t even able to _try_ to parse the thing. Thus the only kinds of exceptions you’re going to get out of TryParse are things like OutOfMemory from JITting or allocating buffers before it even gets a chance to look at the string to be parsed. (You wouldn’t expect to get an exception because the value wasn’t parseable…the point is the method said it was going to try, and it did try. It did what it said it would, so no exception needed.) TryParse really has two results—was the thing parseable, and if so the parsed value.&amp;lt;br&amp;gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#399361</link><pubDate>Sun, 20 Mar 2005 19:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:399361</guid><dc:creator>Vincent</dc:creator><description>Hello, &lt;br&gt;&lt;br&gt;FYI: your blog renders completely wrong in Firefox.</description></item><item><title>re: Common Exception Types</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#403141</link><pubDate>Tue, 29 Mar 2005 03:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:403141</guid><dc:creator>Brad Abrams </dc:creator><description /></item><item><title>Hey, what's with the display?</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#403644</link><pubDate>Wed, 30 Mar 2005 10:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:403644</guid><dc:creator>Goran Pušić</dc:creator><description>&amp;quot;FYI: your blog renders completely wrong in Firefox.&amp;quot;&lt;br&gt;&lt;br&gt;Um... In IE, too!?!? (IE6 on Wn2003)&lt;br&gt;&lt;br&gt;OTOH, like the contents and the reasoning.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#403973</link><pubDate>Thu, 31 Mar 2005 05:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:403973</guid><dc:creator>dan</dc:creator><description>It isn't clear whether you prohibit exceptions from /containing/ error codes (as a property). This ought to be allowed, because in some circumstances your only other options are (a) having a huge set of different exception types or (b) parsing the exception message to figure out what exactly happened.&amp;lt;br&amp;gt;An example of this problem is XmlException, which can be thrown for 1000 different reasons and needs an error code property to distinguish it.</description></item><item><title>Exception Throwing Design Guidelines : Creating our own team exception</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#405568</link><pubDate>Tue, 05 Apr 2005 18:31:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:405568</guid><dc:creator>Rolando Ramirez's WebLog</dc:creator><description /></item><item><title>Exception Throwing Design Guidelines : Performance (another religious war?)</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#405572</link><pubDate>Tue, 05 Apr 2005 18:45:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:405572</guid><dc:creator>Rolando Ramirez's WebLog</dc:creator><description /></item><item><title>Exception Throwing Design Guidelines : Performance (another religious war?)</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#405595</link><pubDate>Tue, 05 Apr 2005 19:25:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:405595</guid><dc:creator>Rolando Ramirez's WebLog</dc:creator><description /></item><item><title>Exception Throwing Design Guidelines : Creating our own team exception</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#405670</link><pubDate>Tue, 05 Apr 2005 22:41:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:405670</guid><dc:creator>Rolando Ramirez's WebLog</dc:creator><description /></item><item><title>Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#410711</link><pubDate>Fri, 22 Apr 2005 11:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410711</guid><dc:creator>Richard Murillo's Blog</dc:creator><description /></item><item><title>Should Exceptions Carry Error Code Information</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#422682</link><pubDate>Fri, 27 May 2005 22:12:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:422682</guid><dc:creator>Krzysztof Cwalina</dc:creator><description>Recently somebody asked me to clarify one of the exception guidelines. They were asking whether it's...</description></item><item><title>Guide on exceptions</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#449782</link><pubDate>Wed, 10 Aug 2005 09:15:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:449782</guid><dc:creator>Wouter van Vugt</dc:creator><description /></item><item><title>Design guidelines for exception throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#619281</link><pubDate>Tue, 06 Jun 2006 21:21:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:619281</guid><dc:creator>Jeff Stong</dc:creator><description>In a recent post I mentioned the .NET framework design guidelines and that reminded me of a post by Krzyztof...</description></item><item><title>Choosing the Right Type of Exception to Throw</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#657270</link><pubDate>Thu, 06 Jul 2006 01:17:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:657270</guid><dc:creator>Krzysztof Cwalina</dc:creator><description>My last post about the ApplicationException resulted in some questions along the lines of “so, if not...</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#682585</link><pubDate>Sat, 29 Jul 2006 17:49:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:682585</guid><dc:creator>JP</dc:creator><description>The use of the word Throw has mulitple meanings in .net. &amp;nbsp;As a result the article is somewhat ambiguous. &amp;nbsp;In object oriented design, the standard of an object is that it is responsible for it's own function. &amp;nbsp;Therefore, it is my understanding that objects and or methods within, should not Throw anything. &amp;nbsp;Instead they should handle the exception and move on. &amp;nbsp;Does your term throw mean &amp;quot;Handle the exception and inform the user?&amp;quot; &amp;nbsp;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#682615</link><pubDate>Sat, 29 Jul 2006 18:40:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:682615</guid><dc:creator>kcwalina</dc:creator><description>I agree that the term “throwing” is a bit ambiguous. It means either executing the throw statement or allowing an exception propagate out of a publicly callable API. &lt;br&gt;&lt;br&gt;I am not sure why you interpret throwing as handling exceptions and showing them to users. Could you point me to any particular statements that might imply so?&lt;br&gt;&lt;br&gt;As to objects handling exceptions and moving on, I think it’s only true for some kinds of exceptions. There are others that simply cannot be handled because the object does not have enough context to know how to fix the state of the system in the exception handler so it could continue safely. Those can sometimes be handled higher up on the stack, but in some cases they cannot be handled at all, and the best approach is to record as much information as possible and shut down the process/app domain.&lt;br&gt;&lt;br&gt;JP, please feel free to email me directly (kcwalina_at_microsoft.dot_com) if you'd like to talk about this more.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#749903</link><pubDate>Mon, 11 Sep 2006 23:58:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:749903</guid><dc:creator>AlSki</dc:creator><description>I came across this article on Exception Throwing by Krysztof Cwalina, and I didn't think its all very good advice... (See &lt;a rel="nofollow" target="_new" href="http://www.alski.net/software/Throwing+Exceptions.aspx"&gt;http://www.alski.net/software/Throwing+Exceptions.aspx&lt;/a&gt;)</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#754930</link><pubDate>Fri, 15 Sep 2006 02:36:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:754930</guid><dc:creator>kcwalina</dc:creator><description>AlSki, I posted a reply comment on your blog. I hope it clarifies some things. Please don't hesitate to email me at kcwalina_at_microsoft.com. I would be happy to discuss more detail.</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#1557430</link><pubDate>Tue, 30 Jan 2007 17:39:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1557430</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Can you provide some guidance for how to structure a hierarchy of exception classes? &amp;nbsp;I cannot find any information addressing this design issue. &amp;nbsp;Should exceptions be grouped by the type of data that the error is associated with, or by the type of error. &amp;nbsp;I think they should be organized by the type of error, but it is very difficult to group errors this way. &amp;nbsp;Thank you for any input you may have.&lt;/p&gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#1739923</link><pubDate>Thu, 22 Feb 2007 10:38:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1739923</guid><dc:creator>NigelAston</dc:creator><description>&lt;p&gt;How would you recommend handling multiple 'error' types that are passed back from hardware devices? For example we are a driving a motor to cause movement, and the command 'move()' can fail for many reasons such as 'HitEndStop', &amp;quot;Stall&amp;quot;, &amp;quot;PowerLoss&amp;quot;. Currently we would do something like:&lt;/p&gt;
&lt;p&gt;CError MoveTheDevice()&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;CError error = Move();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;if (error.IsOk)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;//... continue processing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return error; &amp;nbsp; // to pass status higher up&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Should we create lots of exception types and map the device errors to exception types?&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;should we throw an exception, having recorded the 'error' code somewhere - maybe as a 'parameter' &amp;nbsp;within the exception.&lt;/p&gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#2277866</link><pubDate>Thu, 26 Apr 2007 04:14:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2277866</guid><dc:creator>Sloan</dc:creator><description>&lt;p&gt;Krzysztof ,&lt;/p&gt;
&lt;p&gt;Thank you for the great article. &amp;nbsp;Your ideas are clear and well laid out, and have helped tremendously.&lt;/p&gt;
&lt;p&gt;NigelAston,&lt;/p&gt;
&lt;p&gt;One way I deal with this scenario is using a &amp;quot;base&amp;quot; exception.&lt;/p&gt;
&lt;p&gt;public abstract class HardwareFailureException : System.ApplicationException&lt;/p&gt;
&lt;p&gt;public class HitEndStopException : HardwareFileException&lt;/p&gt;
&lt;p&gt;public class PowerLossException : HardwareFileException&lt;/p&gt;
&lt;p&gt;Then I believe you can just catch the HardwareFileException exception in your code.&lt;/p&gt;
&lt;p&gt;Give it a try!&lt;/p&gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#3957085</link><pubDate>Thu, 19 Jul 2007 19:01:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3957085</guid><dc:creator>CVC</dc:creator><description>&lt;p&gt;Performance is a criteria to take into consideration, but one criteria that is not included in this article is code flow, throwing exceptions sometimes makes you code flow nicer than trying to exit your method earlier and trying to clean up, when you finally statement could handle that, returning error codes from your method when it happens, etc.... I assume that this guidelines apply to exceptions that could occur in .net system classes, but what about classes that I create? If have not seen any issues with performance in throwing exceptions in my production application...It has made the flow of my program much cleaner and easier to understand. &lt;/p&gt;</description></item><item><title>Tratando con excepciones</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#6715603</link><pubDate>Sun, 09 Dec 2007 22:24:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6715603</guid><dc:creator>Pensando en asíncrono</dc:creator><description>&lt;p&gt;Buff... cuanto tiempo desde mi &amp;#250;ltimo post, entre estudiar y la medio-gripe que arrastro desde hace unas&lt;/p&gt;
</description></item><item><title>Tratando con excepciones</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#6715621</link><pubDate>Sun, 09 Dec 2007 22:25:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6715621</guid><dc:creator>vtortola</dc:creator><description>&lt;p&gt;Buff... cuanto tiempo desde mi &amp;#250;ltimo post, entre estudiar y la medio-gripe que arrastro desde hace unas&lt;/p&gt;
</description></item><item><title>Still Learning  &amp;raquo; Blog Archive   &amp;raquo; Exception vs. Error Codes in C++</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#6946417</link><pubDate>Wed, 02 Jan 2008 05:26:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6946417</guid><dc:creator>Still Learning  » Blog Archive   » Exception vs. Error Codes in C++</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://imehta.com/blog-ketan/?p=15"&gt;http://imehta.com/blog-ketan/?p=15&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Izņēmuma situāciju lietošana</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#7047123</link><pubDate>Thu, 10 Jan 2008 03:20:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7047123</guid><dc:creator>Ivara blogs</dc:creator><description>&lt;p&gt;&amp;amp;#352;odien &amp;amp;#160; Vakar Andrejs jau aizskāra tēmu, par kuru es jau pasen gribu uzrakstīt, bet kaut kā&lt;/p&gt;
</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#7052373</link><pubDate>Thu, 10 Jan 2008 11:33:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7052373</guid><dc:creator>rakhs</dc:creator><description>&lt;p&gt;Gud one. &lt;/p&gt;
&lt;p&gt;how we can throw exceptions from Appdomain &amp;quot;A&amp;quot; to appDomain &amp;quot;B&amp;quot;.&lt;/p&gt;
&lt;p&gt;Scenario: &lt;/p&gt;
&lt;p&gt;In AppDomain &amp;quot;B&amp;quot; create a thread and from worker thread call a method in AppDomain &amp;quot;A&amp;quot; , which throws an exception. How we can catch this exception in AppDomain &amp;quot;B&amp;quot;&lt;/p&gt;</description></item><item><title>Dum spiro, spero  &amp;raquo; Blog Archive   &amp;raquo; .NET Exceptions, Performance and Guidelines</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8092590</link><pubDate>Fri, 07 Mar 2008 12:52:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8092590</guid><dc:creator>Dum spiro, spero  » Blog Archive   » .NET Exceptions, Performance and Guidelines</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blog.sanny.maniacs.nu/2008/03/07/net-exceptions-performance-and-guidelines/"&gt;http://blog.sanny.maniacs.nu/2008/03/07/net-exceptions-performance-and-guidelines/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>ASP.NET Exception Handling Best Practices</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8112351</link><pubDate>Sat, 08 Mar 2008 15:22:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8112351</guid><dc:creator>Janko's Blog</dc:creator><description>&lt;p&gt;Exception handling plays an important part of application management and user experience. If implemented&lt;/p&gt;
</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8130342</link><pubDate>Mon, 10 Mar 2008 14:28:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8130342</guid><dc:creator>Licantrop0</dc:creator><description>&lt;p&gt;Hi Krzysztof, Iv'e bought your book and is one of my favourites.&lt;/p&gt;
&lt;p&gt;I wanna ask if you can spend some word about the bad design to rise normal events (named &amp;quot;whateverError&amp;quot; or &amp;quot;whateverException&amp;quot;) instead of throwing exceptions.&lt;/p&gt;
&lt;p&gt;thanks.&lt;/p&gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8156940</link><pubDate>Tue, 11 Mar 2008 21:23:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8156940</guid><dc:creator>kcwalina</dc:creator><description>&lt;p&gt;In rare cases it's better to communicate errors through events. This is true mainly for asynchronous APIs where the original caller thread is long doing some other things and we can not throw to that thread anymore.&lt;/p&gt;
</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8167525</link><pubDate>Wed, 12 Mar 2008 11:33:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8167525</guid><dc:creator>Licantrop0</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;So except for multithreading environment, throwing exception is always the best way. I have many colleagues that sadly mix up event and exception so &amp;quot;you can manage what you prefer!&amp;quot; ... :|&lt;/p&gt;
&lt;p&gt;Could you please write a little explanation about this in your new book?, so if &amp;quot;the .net guidelines bible said so&amp;quot;, they can't complain... :)&lt;/p&gt;
&lt;p&gt;regards!&lt;/p&gt;</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8291742</link><pubDate>Mon, 17 Mar 2008 19:52:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8291742</guid><dc:creator>kcwalina</dc:creator><description>&lt;p&gt;I will try to clarify that in the book (2nd edition), but it already says that exceptions should be the default and other means of communicating errors should be very rare.&lt;/p&gt;
</description></item><item><title>
	Liste over exceptions i .NET
</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8337550</link><pubDate>Wed, 26 Mar 2008 13:11:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337550</guid><dc:creator>
	Liste over exceptions i .NET
</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blog.todobom.dk/post/Liste-over-exceptions-i-NET.aspx"&gt;http://blog.todobom.dk/post/Liste-over-exceptions-i-NET.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Parsing strings with the TryParse method</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8340559</link><pubDate>Fri, 28 Mar 2008 02:03:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8340559</guid><dc:creator> GrabBag&lt;T&gt;</dc:creator><description>&lt;p&gt;This post was originally published here . I recently posted on the out and ref keywords in C#, and mentioned&lt;/p&gt;
</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8550992</link><pubDate>Sun, 25 May 2008 17:16:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8550992</guid><dc:creator>Andrei Rinea</dc:creator><description>&lt;p&gt;A person asked above what should do in case the method called gets an empty string (String.Empty) and such a value is not acceptable?&lt;/p&gt;
&lt;p&gt;Throwing an ArgumentNullException is not the best idea and ArgumentException might be a little too ambigous.&lt;/p&gt;
&lt;p&gt;I always thought of ArgumentEmptyException as an exception class derived from ArgumentException.&lt;/p&gt;
&lt;p&gt;What can you tell us about this issue?&lt;/p&gt;</description></item><item><title>An example of the interplay between language features and library design, part one | abortive</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8720995</link><pubDate>Fri, 11 Jul 2008 14:22:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8720995</guid><dc:creator>An example of the interplay between language features and library design, part one | abortive</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.abortive.com.cn/?p=31"&gt;http://www.abortive.com.cn/?p=31&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Luke Smith  &amp;raquo; Blog Archive   &amp;raquo; Sometimes you have to catch an exception</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8794853</link><pubDate>Thu, 31 Jul 2008 23:43:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8794853</guid><dc:creator>Luke Smith  &amp;raquo; Blog Archive   &amp;raquo; Sometimes you have to catch an exception</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blog.lukesmith.net/index.php/2008/07/31/sometimes-you-have-to-catch-an-exception/"&gt;http://blog.lukesmith.net/index.php/2008/07/31/sometimes-you-have-to-catch-an-exception/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>异常的性能及抛出(Exception Throwing)</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#8994581</link><pubDate>Fri, 10 Oct 2008 20:14:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8994581</guid><dc:creator>译时代</dc:creator><description>&lt;p&gt;1.抛出异常（ExceptionThrowing）&lt;/p&gt;
&lt;p&gt;抛出异常在这篇文章里被定义为是对执行失败时给出的定义。执行失败在任何时候都引出了一个被设计好的程序不去做它应该做的事情。例如，如果打开一个文...&lt;/p&gt;
</description></item><item><title>Favor structured exception handling | Anders Lybeckers Weblog!</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#9003516</link><pubDate>Fri, 17 Oct 2008 21:55:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9003516</guid><dc:creator>Favor structured exception handling | Anders Lybeckers Weblog!</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.lybecker.com/blog/2007/02/21/favor-structured-exception-handling/"&gt;http://www.lybecker.com/blog/2007/02/21/favor-structured-exception-handling/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Best practice error handling? | keyongtech</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#9338432</link><pubDate>Sun, 18 Jan 2009 20:35:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9338432</guid><dc:creator>Best practice error handling? | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/551906-best-practice-error-handling"&gt;http://www.keyongtech.com/551906-best-practice-error-handling&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Design Guidelines Update: Exception Throwing</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#9339507</link><pubDate>Mon, 19 Jan 2009 08:47:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9339507</guid><dc:creator>VS</dc:creator><description>&lt;p&gt;mihailik:&lt;/p&gt;
&lt;p&gt;AFAIK, there is no built in Exception class to check for empty arguments. What I can suggest is this:&lt;/p&gt;
&lt;p&gt;In your method, do this:&lt;/p&gt;
&lt;p&gt;if String.IsNullOrEmpty(param)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; throw new ArgumentException(&amp;quot;The param cannot be null or an empty string.&amp;quot;);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Can somebody comment?&lt;/p&gt;</description></item><item><title>Exception Handling | keyongtech</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#9363853</link><pubDate>Thu, 22 Jan 2009 09:45:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9363853</guid><dc:creator>Exception Handling | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/433205-exception-handling"&gt;http://www.keyongtech.com/433205-exception-handling&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Krzysztof Cwalina Design Guidelines Update Exception Throwing | fix my credit</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#9763890</link><pubDate>Wed, 17 Jun 2009 04:35:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9763890</guid><dc:creator> Krzysztof Cwalina Design Guidelines Update Exception Throwing | fix my credit</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://fixmycrediteasily.info/story.php?id=10173"&gt;http://fixmycrediteasily.info/story.php?id=10173&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Krzysztof Cwalina Design Guidelines Update Exception Throwing | Outdoor Decor</title><link>http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx#9778948</link><pubDate>Fri, 19 Jun 2009 07:17:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9778948</guid><dc:creator> Krzysztof Cwalina Design Guidelines Update Exception Throwing | Outdoor Decor</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://outdoordecoration.info/story.php?id=1835"&gt;http://outdoordecoration.info/story.php?id=1835&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>