Hi, From: "Graham Nicholls" <graham / rockcons.co.uk> > > Is there any way of preventing runtime errors caused by syntax errors - if > these reside in a piece of code which is not usually executed, testing can > be difficult. I use this construct in a server that I want to keep running in the event of unanticipated exceptions being raised: begin loop { # main server loop } rescue Interrupt, IRB::Abort, NoMemoryError, SystemExit => ex puts "Caught exception: #{ex} at #{ex.backtrace[0]} - saving and shutting down..." rescue Exception => ex puts "Caught exception: #{ex} at #{ex.backtrace[0]} - ignoring and continuing..." sleep 1 retry ensure # program shutdown end I put in the "sleep 1" before the retry in case the error might recur repeatedly - so as not to go in a tight loop using up 100% CPU and filling up the logfile with "Caught exception - ignoring and continuing..." messages at top speed. :) Regards, Bill