I am currently writing a small framework that will be used internally by other developers within the company.
I want to provide good Intellisense information, but I am not sure how to document thrown exceptions.
In the following example:
public void MyMethod1()
{
MyMethod2();
// also may throw InvalidOperationException
}
public void MyMethod2()
{
System.IO.File.Open(somepath...); // this may throw FileNotFoundException
// also may throw DivideByZeroException
}
I know the markup for documenting exceptions is:
/// <exception cref="SomeException">when things go wrong.</exception>
What I don't understand is how to document exceptions thrown by code called by MyMethod1()
?
- Should I document exceptions thrown by
MyMethod2()
- Should I document exceptions thrown by
File.Open()
?
What would be the best way to document possible exceptions?