On Jan 15, 2008 11:14 PM, Prasad Pednekar <prasadm29 / gmail.com> wrote: > I was trying out the following snippet of code and just wanted to > know why the rescue doesn't work when the username or password are not > valid. The code works fine when both are valid, but I wanted to catch > invalid login error and take action, but so far can't do so. It's because not all exceptions are created equal :) Some (most) are inherited from StandardError, which you will catch with a simple rescue statement, others come from other parent classes. Here is a short write up on it for you, it talks about Net::POP3, but you are probably running into the same thing: http://lindsaar.net/2007/12/9/rbuf_filltimeout-error Regards Mikel