﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Troy commented on And now this is what I call error handling</title><description>This is the result of your years of support. 
  
  
I don't think you should put training or enforce good practice through error messages. But, neither can I say I wouldn't do it. At the end of the day, losing some number of phone calls to your tech support is money in your pocket--both from less support AND from the bad press: "This stupid Raven thing runs so slow . . ." yada, yada, yada.
  
  
I'd search hard for a more appropriate vehicle for the message. But, maybe there isn't one that would be as effective.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment31</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment31</guid><pubDate>Thu, 27 May 2010 01:04:48 GMT</pubDate></item><item><title>Jeff Tucker commented on And now this is what I call error handling</title><description>What about "throw new BadCodingPracticeException" instead?
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment30</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment30</guid><pubDate>Wed, 26 May 2010 18:03:28 GMT</pubDate></item><item><title>Steve Py commented on And now this is what I call error handling</title><description>Ah, so it's total requests, not current requests. I.C.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment29</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment29</guid><pubDate>Tue, 25 May 2010 23:50:10 GMT</pubDate></item><item><title>Ayende Rahien commented on And now this is what I call error handling</title><description>Steve,
  
The problem isn't temporary, if you make another request, it should be blocked as well.
  
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment28</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment28</guid><pubDate>Tue, 25 May 2010 23:22:46 GMT</pubDate></item><item><title>Steve Py commented on And now this is what I call error handling</title><description>+1 to Geert !
  
  
Incrementing then throwing the exception is a bad idea. If the exception is caught and handled (I.e. make the requester wait, etc.) then you've increased the count without using a request; Poluting your request count with false requests, hindering performance when "real" requests are let go.
  
  
Your intent might be that during development developers would receive this exception and re-factor their design. Real-world though is that stuff like this will come up in UAT/Production and bug fixes will effectively be jury-rigs. A caught and handled exception in this case is now a behaviour bug. It's fine to provide details within the exception, if something needs to be told to a user they should be presenting an application-meaningful exception message anyways.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment27</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment27</guid><pubDate>Tue, 25 May 2010 22:33:57 GMT</pubDate></item><item><title>Isaac commented on And now this is what I call error handling</title><description>Conceptually great, but the writing could use some help. "It is advisable that you'll look into reducing" should just be "Consider reducing".
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment26</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment26</guid><pubDate>Tue, 25 May 2010 20:35:43 GMT</pubDate></item><item><title>Kevin Kuebler commented on And now this is what I call error handling</title><description>throw new YerDoinItWrongException();
  
  
;-)
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment25</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment25</guid><pubDate>Tue, 25 May 2010 17:25:00 GMT</pubDate></item><item><title>Diego Mijelshon commented on And now this is what I call error handling</title><description>I like the idea.
  
One of the things I *LOVE* about NHibernate, for example, is that the error messages usually give you enough information to know what's wrong and how to fix it without having to open a debugger every time.
  
  
The only change I'd do would be introducing a MaximumNumberOfRequestsException like Dennis suggested (whether or not to derive it from InvalidOperationException is up to you)
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment24</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment24</guid><pubDate>Tue, 25 May 2010 16:37:38 GMT</pubDate></item><item><title>Dan Finch commented on And now this is what I call error handling</title><description>This is a good thing
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment23</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment23</guid><pubDate>Tue, 25 May 2010 16:36:58 GMT</pubDate></item><item><title>Matt Warren commented on And now this is what I call error handling</title><description>@Dennis, you can override the default if you want to. but see 
[groups.google.com/.../d0cfb634b89a75e8](http://groups.google.com/group/ravendb/browse_thread/thread/b30b2faeac1e4164/d0cfb634b89a75e8?lnk=gst&amp;q=max+queries#d0cfb634b89a75e8) for a discussion of why you might not want to.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment22</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment22</guid><pubDate>Tue, 25 May 2010 16:33:33 GMT</pubDate></item><item><title>Darren Kopp commented on And now this is what I call error handling</title><description>And then that throws an OutOfMemoryException XD
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment21</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment21</guid><pubDate>Tue, 25 May 2010 15:38:15 GMT</pubDate></item><item><title>Demis Bellot commented on And now this is what I call error handling</title><description>I think long error messages like this would break the rendering of UI error/warnings on the client. 
  
  
I prefer an error code and a 'succinct error message' and a url for a more detailed explanation where I could explore other comments and solutions from people who have also encountered this error. If you don't provide a url yourself then you should at least supply an error code so its googable.
  
  
IMHO motivations behind why you've chosen to throw an error have no place in an Exception message (that's what documentation is for) - it's long enough as it is.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment20</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment20</guid><pubDate>Tue, 25 May 2010 14:42:32 GMT</pubDate></item><item><title>Matthew Espinet commented on And now this is what I call error handling</title><description>What does it want me to do?
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment19</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment19</guid><pubDate>Tue, 25 May 2010 13:53:17 GMT</pubDate></item><item><title>Geert Baeyaert commented on And now this is what I call error handling</title><description>You probably don't want to increment numberOfRequests when you throw the exception.  
  
  
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment18</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment18</guid><pubDate>Tue, 25 May 2010 12:27:59 GMT</pubDate></item><item><title>tobi commented on And now this is what I call error handling</title><description>Just great. I wish it was always like this. Both the message and the "warning" exception that you have to explicitly disable.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment17</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment17</guid><pubDate>Tue, 25 May 2010 12:05:35 GMT</pubDate></item><item><title>Peter commented on And now this is what I call error handling</title><description>I like these kind of error messages, because they help a developer much more than general messages (NullReferenceException anyone?).
  
  
@Neil: if you use ReSharper to rename methods, it will search in strings also, so that shouldn't be a problem.
  
  
Oh, also some nitpicking: ... Raven provideS facilities ...
  
  
Nice work, can't wait to try out Raven.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment16</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment16</guid><pubDate>Tue, 25 May 2010 11:59:53 GMT</pubDate></item><item><title>Ayende Rahien commented on And now this is what I call error handling</title><description>Rafal,
  
No one read the logs.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment15</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment15</guid><pubDate>Tue, 25 May 2010 11:53:53 GMT</pubDate></item><item><title>Ayende Rahien commented on And now this is what I call error handling</title><description>Neil,
  
Those type of things don't change often.
  
And you basically need to remember those.
  
Nothing really fancy or high tech. The advantage that you can get from that is huge
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment14</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment14</guid><pubDate>Tue, 25 May 2010 11:53:49 GMT</pubDate></item><item><title>Rafal commented on And now this is what I call error handling</title><description>Nice error message, but in this case I'd rather warn the administrator and continue servicing requests without scarying application users and suggesting the application is broken.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment13</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment13</guid><pubDate>Tue, 25 May 2010 11:41:53 GMT</pubDate></item><item><title>Neil Barnwell commented on And now this is what I call error handling</title><description>Ayende,
  
Yeah, I have to admit I've always wanted to do it, but always changed my mind at the last minute because of reason I mentioned.  It's kind've like documentation - it's hard to keep it up to date and in-sync with the code.
  
  
Do you have any tips for keeping these kind of messages relevant over time, when there are many of them?  Surely even you can't just remember where they all are and update them when something changes? :)
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment12</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment12</guid><pubDate>Tue, 25 May 2010 11:36:07 GMT</pubDate></item><item><title>Ayende Rahien commented on And now this is what I call error handling</title><description>Neil,
  
I learned that style from Castle, where it has been successful for over half a decade.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment11</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment11</guid><pubDate>Tue, 25 May 2010 11:23:27 GMT</pubDate></item><item><title>Ayende Rahien commented on And now this is what I call error handling</title><description>armoured.frog,
  
Yes, thanks, fixed.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment10</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment10</guid><pubDate>Tue, 25 May 2010 11:22:01 GMT</pubDate></item><item><title>Aikin commented on And now this is what I call error handling</title><description>Hei guys! That is the ESSENTIAL! The idea. No more. 
  
  
Try to do the same proper way (resources, exception helpers, ...).
  
And when you finish just compare your (COOL and PROPER) code with the one provided. Is it EASY to understand what you did want to explain?
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment9</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment9</guid><pubDate>Tue, 25 May 2010 11:13:50 GMT</pubDate></item><item><title>Neil Barnwell commented on And now this is what I call error handling</title><description>I like the idea of error messages that actually say what the problem is, and even tell you what to do, but I'm torn.  I'm torn because the message is effectively a kind of magic string that has details like configuration item names etc, which is going to go out of date if you refactor in the future (say for example you decide to write a clever algorithm that automatically works out the max requests value based on historical usage to determine extraordinary behaviour).
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment8</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment8</guid><pubDate>Tue, 25 May 2010 10:45:16 GMT</pubDate></item><item><title>Dennis commented on And now this is what I call error handling</title><description>It should throw a MaximumNumberOfRequestsException instead. You aren't doing an Invalid operation, you have just passed the useful limit.
  
  
And why is it I would always have to know ahead of time how many queries I am going to be executing. This will be an absolute nightmare for an application 10 years down the road where the source code is long gone.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment7</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment7</guid><pubDate>Tue, 25 May 2010 10:36:55 GMT</pubDate></item><item><title>Rob Ashton commented on And now this is what I call error handling</title><description>I quite like the concept of a more responsible application.
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment6</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment6</guid><pubDate>Tue, 25 May 2010 10:14:06 GMT</pubDate></item><item><title>armoured.frog commented on And now this is what I call error handling</title><description>don't mean to nitpick..but did you mean  "result in a more *responsive* application."
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment5</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment5</guid><pubDate>Tue, 25 May 2010 09:56:36 GMT</pubDate></item><item><title>Andrew commented on And now this is what I call error handling</title><description>Shouldn't it be numberOfRequests++ (a max of 1 query should mean 1 query is OK, but 2 is not) :P
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment4</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment4</guid><pubDate>Tue, 25 May 2010 09:41:22 GMT</pubDate></item><item><title>Huseyin Tufekcilerli commented on And now this is what I call error handling</title><description>This guy seriously needs to learn about StringResources
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment3</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment3</guid><pubDate>Tue, 25 May 2010 09:24:00 GMT</pubDate></item><item><title>grega_g commented on And now this is what I call error handling</title><description>DRY violation?
</description><link>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment2</link><guid>http://ayende.com/4520/and-now-this-is-what-i-call-error-handling#comment2</guid><pubDate>Tue, 25 May 2010 09:21:48 GMT</pubDate></item></channel></rss>