From: Kelly Felkins Date: 2006-03-07T11:50:22+09:00 Subject: threads and exceptions ------=_Part_4345_30580935.1141699807509 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I've built a small web service using webrick. The service runs on a separat= e thread. When it gets an exception it, apparently, dies...it being the thread. Is there a way to catch the exception without the thread exiting? The code is opening a file so I wrapped it in a begin/rescue block, but it doesn't seem to help. begin File.open(buffer[:file_name], 'a') do |f| f.print(buffer[:text]) end rescue Exception @logger.error("could not write message\n #{$!}\n file >#{buffer[:file_name]}<\n message >#{buffer[:text]}<") end If the file is invalid I think the thread dies -- but I don't see a message anywhere. -Kelly ------=_Part_4345_30580935.1141699807509--