From: Matt Armstrong Date: 2003-01-16T06:39:20+09:00 Subject: Re: $DEBUG and exceptions Joel VanderWerf writes: > Joel VanderWerf wrote: >> What's the rationale for debug mode echoing all those exceptions to >> stderr? That makes me want to avoid either using exceptions as a >> control structure or using $DEBUG... > > Maybe it's not clear that I meant *handled* exceptions, as in the > following. Why would I want to know all the exceptions that were > raised, unless they were uncaught? > > $DEBUG=true > 10.times do |i| > begin > raise "#{i}" > rescue StandardError > end > end > > puts "Done!" If you look at the ruby source, $DEBUG does only 2 things: - prints out exceptions when they happen - act as if Thread.abort_on_exception = true, even if it isn't. If you don't like the first, just set Thread.abort_on_exception to true. ;-)