<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Thinking inside a bigger box - Latest Comments in The Joys and Sorrows of Exceptions</title><link>http://thinkinginsideabiggerbox.disqus.com/</link><description></description><language>en</language><lastBuildDate>Sun, 22 Apr 2007 12:22:54 -0000</lastBuildDate><item><title>Re: The Joys and Sorrows of Exceptions</title><link>http://www.brodwall.com/johannes/blog/2006/08/13/the-joys-and-sorrows-of-exceptions/#comment-1796633</link><description>Good questions, Casey.&lt;br&gt;&lt;br&gt;We have created subclasses of RuntimeException for SystemException and ApplicationException (should've been InvalidUsageException). Everything that is not classified is a "bug". Out top-level interceptors which log, retry etc. use this to decide the log level and retry strategy.&lt;br&gt;&lt;br&gt;I don't think the categories I propose have been used as such in any open source project. However, I think one of the best things about the &lt;a href="http://www.springframework.org/docs/reference/dao.html" rel="nofollow"&gt;Spring Exceptions&lt;/a&gt;, is that they allow you to decide what sort of a problem it was.&lt;br&gt;&lt;br&gt;DataAccessResourceFailureException tells you that the database or network is down, InvalidDataAccessUsageException tells you that the client code did something wrong, OptimisticLockFailureException is not actually an error at all (and my categories don't include it). In JDBC, these, and more, were lumped together as SQLException.&lt;br&gt;&lt;br&gt;I guess what I am trying to say, is that as far as I know, the categories I propose are more a description of &lt;b&gt;why&lt;/b&gt; I think Spring has good exceptions than it is a description of what they've done.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Johannes Brodwall</dc:creator><pubDate>Sun, 22 Apr 2007 12:22:54 -0000</pubDate></item><item><title>Re: The Joys and Sorrows of Exceptions</title><link>http://www.brodwall.com/johannes/blog/2006/08/13/the-joys-and-sorrows-of-exceptions/#comment-1796632</link><description>I just read "Practices of an Agile Developer" as well, and the categories do sound useful... although I am not sure how to practically express the categorization of a given exception. If i'm the thrower, I could throw my own "categorized" exception, but what about exceptions emanating from some other library? &lt;br&gt;&lt;br&gt;Does anyone know of any practical (open source?) project that has made practical, explicit use of these (or similar) categories? Or are these categories more theoretical than practical?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Casey Mullen</dc:creator><pubDate>Fri, 20 Apr 2007 21:04:00 -0000</pubDate></item><item><title>Re: The Joys and Sorrows of Exceptions</title><link>http://www.brodwall.com/johannes/blog/2006/08/13/the-joys-and-sorrows-of-exceptions/#comment-1796631</link><description>Good writeup Johannes, what could be interestning as well is to add some practical examples related to common mistakes. &lt;br&gt;&lt;br&gt;I often encounter the issue programs failing to establish a proper context in programs that raises exceptions. &lt;br&gt;&lt;br&gt;Establishing such a context is trivial, but often omitted rendering the code much more difficult to debug. consider the following example of an instance method in an Account class:&lt;br&gt;&lt;br&gt;public void validateAcount() {&lt;br&gt;        if (isOverdrawn()) {&lt;br&gt;            throw new IllegalStateException("Account is overdrawn, balance ["+getBalance()+"], limit ["+getLimit()+"]");&lt;br&gt;        }&lt;br&gt;&lt;br&gt;    }&lt;br&gt;&lt;br&gt;compared to the following version that has context (given a proper toString() implementation):&lt;br&gt;&lt;br&gt;public void validateAcount() {&lt;br&gt;        if (isOverdrawn()) {&lt;br&gt;            throw new IllegalStateException("["+this+"] is overdrawn, balance ["+getBalance()+"], limit ["+getLimit()+"]");&lt;br&gt;        }&lt;br&gt;&lt;br&gt;    }</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bjørn Bjerkeli</dc:creator><pubDate>Mon, 21 Aug 2006 06:48:56 -0000</pubDate></item><item><title>Re: The Joys and Sorrows of Exceptions</title><link>http://www.brodwall.com/johannes/blog/2006/08/13/the-joys-and-sorrows-of-exceptions/#comment-1796630</link><description>Hi Sergio,&lt;br&gt;&lt;br&gt;Thanks for the comment. I agree with you that business exceptions deserve a whole post of its own. I would really appreciate feedback on what you'd like to read about in such a post.&lt;br&gt;&lt;br&gt;There are two types of exception handling strategies that I could explore more fully: Things like retrying, failing to another node or mechanism and such strategies, mostly for resource exceptions. Then there is "what to do when you get an AccountOverDraftException, NumberFormatException, AuthorizationFailureException etc." I assume it is the latter you are refering to?&lt;br&gt;&lt;br&gt;~Johannes</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Johannes Brodwall</dc:creator><pubDate>Thu, 17 Aug 2006 10:14:56 -0000</pubDate></item><item><title>Re: The Joys and Sorrows of Exceptions</title><link>http://www.brodwall.com/johannes/blog/2006/08/13/the-joys-and-sorrows-of-exceptions/#comment-1796629</link><description>Hi Johannes,&lt;br&gt;&lt;br&gt;thanks for your good write up about exception handling, IMHO a very hot argument.&lt;br&gt;&lt;br&gt;However, what you miss is IMHO how to deal with business exceptions: a very important question that may deserve a whole post ;)&lt;br&gt;&lt;br&gt;Probably they are those exceptions you say "you are required to deal with" ... I'd like to know more from your opinion and experience.&lt;br&gt;&lt;br&gt;Cheers!&lt;br&gt;&lt;br&gt;Sergio B.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sergio Bossa</dc:creator><pubDate>Tue, 15 Aug 2006 17:17:50 -0000</pubDate></item></channel></rss>