How should I document exceptions thrown by a method?

Arcadio arcadiosincero at gmail.com
Wed Jul 27 15:32:25 EDT 2011


I use Doxygen to document my source code, and I'm wondering how
exceptions thrown by a method of a class should be documented in the
following example.

I have a Settings class that is used to hold application settings.  A
Settings object initializes itself from a ConfigParser that gets
passed in as an argument to the constructor.  If a setting isn't found
in whatever the ConfigParser is reading settings from, the
ConfigParser's get() method will raise an exception.  Should I just
say that clients of my Settings class should be prepared to catch
exceptions thrown by ConfigParser?  Do I even have to mention that as
it might be just implied?  Or should Setting's constructor catch any
exceptions raised by the ConfigParser and "convert it" to a Settings-
specific exception class that I then document?




More information about the Python-list mailing list