In dbi.rb (from the Ruby DBI package), there is the following code:

# try a quick load and then a caseless scan
begin
  require "#{DBD::DIR}/#{driver_name}/#{driver_name}"
rescue LoadError
  ... || (try other filenames)
end

The "rescue LoadError" is meant to catch an error in case the filename
being loaded didn't exist, in which case it will try to find it
elsewhere.

The problem with "rescue LoadError" is that it will also catch errors
it wasn't meant to! In my case, the file it loaded existed, but
requiring that file threw a LoadError because there was some other
problem with it. So the "rescue" caught an error it wasn't meant to
catch, and just made debugging harder.

This seems to be an inflexibility with the begin/rescue/end construct.
If 'require' was a function that returned a false value upon failing
to load its argument, then the code could have done this:

require "#{DBD::DIR}/#{driver_name}/#{driver_name}" || begin
  ... (try other filenames)
end

Any thoughts about this inflexibility of the begin/rescue/end system?