Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • 8
    Why not just leave catch { throw } out altogether? Commented May 19, 2009 at 8:07
  • 119
    For some reason, the name of the SQLException bothers me. Commented May 20, 2009 at 21:13
  • 17
    That catch (Exception) { throw new Exception(...) } is something you should never, ever, ever do, simply because you're obfuscating the exception information and making exception filtering further up the call stack unnecessarily difficult. The only time you should catch one type of exception and throw another is when you are implementing an abstraction layer and you need to transform a provider-specific exception type (e.g. SqlException versus XmlException) into a more generic one (e.g. DataLoadingException). Commented Oct 18, 2010 at 12:14
  • 5
    I have a feeling that this code's WrappedException forgets the wrapping. Was it the author's intention to put the original exception in that constructor as InnerException? Commented Jul 3, 2015 at 12:36
  • 8
    Under MS convention, only two-letter acronyms should remain uppercase (IOException), longer acronyms should be PascalCased (SqlException). Unlike in Java (see SQLException). That's the reason probably why SQLException bothers you, @MichaelMyers. Commented Nov 15, 2016 at 18:38