From: Nigel Henbest Date: 2006-05-31T00:15:51+09:00 Subject: Re: exception handling Nikolai Weibull wrote: > On 5/30/06, Nigel Henbest wrote: >> I have a(nother) question concerning exception handling. >> >> Occasionally, yahoo will drop requests which results in timeout >> exceptions. I would like to "catch" the exception and simply continue >> with the next ticker. > > require 'yahoofinance' > > tickers = File.new("/home/nigels/financials/symbols") > tickers.each_line do |ticker| > begin > quotes = YahooFinance::get_standard_quotes( ticker ) > quotes.each do |symbol, qt| > ... > end > rescue > # Do nothing, just continue with the next ticker. > end > end > > Peace. > > nikolai So simple! Thank you. -- Posted via http://www.ruby-forum.com/.