﻿<?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>Asbj&amp;#248;rn Ulsberg commented on Kobe – an example of exception handling done wrong</title><description>You are completely right, Ayende. This example isn't exception "handling", it's exception "swallowing". It's catching the exception to forget about it and never know it ever occurred. That's exceptionally (pun intented ;) bad architecture.
  
  
Exception handling, e.g. writing try/catch, should as you write, happen when you know what exception may occur and act upon it to do something constructive, or when presenting something to another system or user.
  
  
Swallowing exceptions and returning null is almost never a good idea, unless that's well-defined behaviour in your system. For example, catching a FileNotFound exception and returning null could make sense in some situations, especially if the reason for not getting any content back doesn't matter to the client.
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment10</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment10</guid><pubDate>Fri, 24 Apr 2009 14:13:07 GMT</pubDate></item><item><title>Hendry Luk commented on Kobe – an example of exception handling done wrong</title><description>meisinger
  
I think what Oren means by 'system boundary' is the outmost presentation layer of your system that interacts with the clients (i.e. human user or other systems that uses your system); instead of low-level parts of the system that touches other systems (DB, web-service), which is exactly where this post argues *not* to put exception handling.
  
Although in reality, I do have exception handling in those low-level parts to deal with retry/fallover. When the failure is impossible to resolve, the exception is bubbled up to system boundary.
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment9</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment9</guid><pubDate>Mon, 20 Apr 2009 03:17:30 GMT</pubDate></item><item><title>Mr_Simple commented on Kobe – an example of exception handling done wrong</title><description>Gosh my little pea brain likes to wrap everything and send all errors to my log file as soon as possible along with notifying the user.
  
  
This way my programs are bulletproof and I can fix any bugs and get on with programming other much needed applications in record time.
  
  
Sometimes I wonder if keeping things simple is - well, too simple.
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment8</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment8</guid><pubDate>Sat, 18 Apr 2009 14:25:35 GMT</pubDate></item><item><title>JeroenH commented on Kobe – an example of exception handling done wrong</title><description>I could not agree more with this remark. This kind of exception 'handling' (which I suspect stems from the Enterprise Library Exception Handling Block and the way it is 'advertised') is a fundamental flaw in several applications I have been forced to work on in the past. 
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment7</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment7</guid><pubDate>Fri, 17 Apr 2009 20:38:25 GMT</pubDate></item><item><title>meisinger commented on Kobe – an example of exception handling done wrong</title><description>totally agree on the system boundry part
  
  
i like to think of it more like a "machine" boundry 
  
so if i am talking to the database... i have exception handling
  
if i am talking to a web service or message service... i have exception handling
  
  
the only other time that i have exception handling is when i am about to send the data to the user (typically in a global manner)
  
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment6</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment6</guid><pubDate>Fri, 17 Apr 2009 16:40:44 GMT</pubDate></item><item><title>Ayende Rahien commented on Kobe – an example of exception handling done wrong</title><description>Dirk,
  
The exception is handled at the system boundary
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment5</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment5</guid><pubDate>Fri, 17 Apr 2009 13:36:26 GMT</pubDate></item><item><title>Dirk commented on Kobe – an example of exception handling done wrong</title><description>The exception has to be handeld somewhere doesn't it?
  
  
Otherwise you would be seeing stack traces in the UI...
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment4</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment4</guid><pubDate>Fri, 17 Apr 2009 13:30:53 GMT</pubDate></item><item><title>huey commented on Kobe – an example of exception handling done wrong</title><description>I guess it depends on specifics... but the controller is a decent place for exception handling?  It seems like the visible boundary to the user.
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment3</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment3</guid><pubDate>Fri, 17 Apr 2009 13:01:32 GMT</pubDate></item><item><title>Ayende Rahien commented on Kobe – an example of exception handling done wrong</title><description>Poul,
  
Wrapping exceptions (to add additional contextual information) is important, but I wouldn't call it _handling_ the exception
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment2</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment2</guid><pubDate>Fri, 17 Apr 2009 11:22:20 GMT</pubDate></item><item><title>Poul Foged Nielsen commented on Kobe – an example of exception handling done wrong</title><description>When you talk about handling of exceptions, you're not covering actual wrapping of exceptions (though innerexception) right?
  
  
Becourse I still think that's pretty important ... (other places than the two you mention).
</description><link>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment1</link><guid>http://ayende.com/3952/kobe-an-example-of-exception-handling-done-wrong#comment1</guid><pubDate>Fri, 17 Apr 2009 09:45:40 GMT</pubDate></item></channel></rss>