none
Errors in documentation of exceptions a method could throw RRS feed

  • Question

  • Hi all,

    I have a general question regarding the documentation of methods which could throw an exception. The documentation (in this case .NET 4.0) makes the impression that all possible exceptions which a method could throw are mentioned within the respective method's documentation.

    But yesterday, I recognized that this isn't true (the GetQuery method of the BitmapMetadata class throws at least one exception type which is not documented). Until now, I always have relied upon that all exceptions of a method are documented.

    Now, what's the official policy regarding this? Is there an error just in the documentation of the GetQuery method, or did I misunderstand something? Are only the most important exceptions documented with each method?

    Thanks in advance for any replies,

    Binarus

    Thursday, April 24, 2014 7:35 AM

Answers

  • Not every exception is listed, only the one's explicitly thrown (and sometimes those that may be thrown by called methods).  Aka the one's you are most likely to want to handle in catch blocks.  For example any method can technically throw an OutOfMemoryException or StackOverflowException but they aren't listed because you wouldn't normally handle them. 

    Michael Taylor
    http://msmvps.com/blogs/p3net

    • Marked as answer by Binarus Friday, April 25, 2014 6:45 AM
    Thursday, April 24, 2014 2:16 PM
    Moderator

All replies

  • Not every exception is listed, only the one's explicitly thrown (and sometimes those that may be thrown by called methods).  Aka the one's you are most likely to want to handle in catch blocks.  For example any method can technically throw an OutOfMemoryException or StackOverflowException but they aren't listed because you wouldn't normally handle them. 

    Michael Taylor
    http://msmvps.com/blogs/p3net

    • Marked as answer by Binarus Friday, April 25, 2014 6:45 AM
    Thursday, April 24, 2014 2:16 PM
    Moderator
  • Thank you very much. I already had the suspect, because it's logic, but I have not seen any undocumented exception until yesterday, hence the question.
    Friday, April 25, 2014 6:44 AM