Hi
   I have the following code It is working I have no file named a
begin
  f=File.open('a')
  rescue Exception => exception
        if exception.message == 'No such file or directory - a'
         puts ' in first rescue'
       else
        puts 'in else case'
       end
end

So here I get 'in first rescue'

Now what i did is I deliberately changed exception.message1 .So sure I
will get an excption here And How cn I handle that(This is for learning
only).I tried like

begin
  f=File.open('a')
  rescue Exception => exception
        if exception.message1 != 'No such file or directory - a'
         puts ' in first rescue'
       else
        puts 'in else case'
        rescue NoMethodError => e:
                puts e.to_s
   # raise
   # puts 'error'
       end
end
      But it gives syntax error
        rescue NoMethodError => e:
   How can I solve this..Even now searching a lot in google I am not
that much confident in exception handling in Ruby and also rails

Thanks in advance
Sijo
-- 
Posted via http://www.ruby-forum.com/.