From: Robert Klemme Date: 2008-08-22T19:50:15+09:00 Subject: Re: Nesting exception 2008/8/22 Sijo Kg : > I tried > begin > f=File.open('a') > rescue Exception => exception > if exception.message1 == 'No such file or directory - a' > puts ' in if part of rescue' > else > puts 'in else case' > rescue NoMethodError => e: > puts e.to_s > end > end > Above I purposefully changed exception.message to > exception.message1. If it was exception.message and also > rescue NoMethodError => e: > puts e.to_s > were absent I would get 'in if part of rescue'..So as everyone know > exception.message1 doesnot exists. I would like to know how to handle > that exception. Where to place that rescue(Am I right?) First of all, you cannot use a symbol where you are using it as Hemant already remarked. Second, if you want to catch exceptions that occur during exception handling you need to put a begin rescue end block inside the rescue block. robert -- use.inject do |as, often| as.you_can - without end