Thanks Wilson!

Wilson Bilkovich wrote:
> I would recommend doing:
> raise RuntimeError, "#{proto} failed"
> ..instead of:
> raise "#{proto} failed"
> 
> Then you can do rescue RuntimeError => e
> ..and e.message will contain the text of the exception.  (e.g. IMAP 
> failed)

I'll give it a try.
> 
> Also, you don't really need two identical rescue clauses at the top,
> for the two different kinds of error.

Hmmm.... I initially had the two errors on the same rescue but I got 
syntax errors

> Personally, I would prevent try_imap from ever raising an exception,
> and just return a status code. One for success, one for failure, and
> one for an exception.  That would greatly clean up the code that calls
> it.

Yep, that probably would be a better way of doing it but I wanted to 
play with the  exceptions:)  It is one feature of ruby that I am not 
familiar with from the other languages that I've used.

I'll probabaly cut it out of the final version.


-- 
Posted via http://www.ruby-forum.com/.