From: Chris Pine Date: 2003-01-03T02:20:02+09:00 Subject: Re: Are we even getting close? ----- Original Message ----- From: "Ted" Newsgroups: comp.lang.ruby Sent: Thursday, January 02, 2003 7:43 AM Subject: Re: Are we even getting close? Now we're getting somewhere! I was thinking that I'd need one for each condition, and that one rescue for the three conditions is the result of misched-up thinking. I've seen too many sloppy programs that did this sort of thing. But Ruby is different? Enquiring minds need to know... ---------------------------- Well, it depends on what you are trying to do. If you are just printing the error and then exiting, then a top-level rescue is perfect for you. If you want to recover from your error, then you put the rescue where you want the recovery to happen. So if your MySQL connection fails, you could just exit the program (top-level rescue clause), or you could try to open a different database (rescue should be right after your connection attempt)... it's all about where you want program execution to continue after you rescue the error. (Honestly, if you are just printing the error and exiting, why rescue it at all? Ruby will do that much for you! Unless for some reason you *really* want the error message to go to $stdout instead of $stderr...) Just my two cents, Chris