Create explicit test cases where you demonstrate (and check, of course)
in what circumstances your class can generate custom exceptions. Refer
to them from your documentation.
Gennady.
···
-----Original Message-----
From: Jon Baer [mailto:jonbaer@jonbaer.com]
Sent: Thursday, January 19, 2006 8:27
To: ruby-talk ML
Subject: rdoc, api + exceptions
Hi,
Ive become a pretty big fan of Ruby in the past month during my time off
and while going through PickAxe book and looking around Im not sure if
im missing something fundamental about exceptions ... (bare w/ me as I
am a Java/PHP convert)
Normally when developing an API you can express what exceptions may
occur when invoking a particular method ...
public foobar() throws BadFooBarException
In Ruby, it would seem to me that nearly ~everything~ can throw at least
one exception (or at least cause NameError), so Im wondering at least
how you would document that your method should be placed in a
begin/rescue/end block from a custom exception.
Thanks!
- Jon