From: Brian Candler Date: 2007-02-09T18:06:47+09:00 Subject: Re: Help begin/rescue/ensure On Fri, Feb 09, 2007 at 02:20:30PM +0900, S Kanakakorn wrote: > require 'rubygems' > require 'net/ssh' > > begin > session = Net::SSH.start('aaaa-lnx', :password=>'xyz', > :username=>'root',:timeout=>5) > rescue > puts 'cannot connect ' > ensure > puts 'reach ensure point' > end > puts 'at last' ... > What did I do wrong ? A bare "rescue" doesn't catch all exceptions, only those which are subclasses of StandardError. Change to: rescue Exception HTH, Brian.