From: "yimutang (Joey Zhou)" Date: 2012-03-26T12:15:29+09:00 Subject: [ruby-core:43676] [ruby-trunk - Bug #6202][Open] The 'rescue' modifier can not be used in 'require' Issue #6202 has been reported by yimutang (Joey Zhou). ---------------------------------------- Bug #6202: The 'rescue' modifier can not be used in 'require' https://bugs.ruby-lang.org/issues/6202 Author: yimutang (Joey Zhou) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p125 (2012-02-16) [i386-mingw32] My Ruby version is: ruby 1.9.3p125 (2012-02-16) [i386-mingw32] I found that the 'rescue' modifier can not be used in 'require', for example: require 'not_exist' rescue require 'set' # this will raise a LoadError I must write a begin/rescue block to do this: begin require 'not_exist' rescue LoadError require 'set' # this is ok end I don't know if it is a bug, I think a one-line require/rescue may be good idiom. -- http://bugs.ruby-lang.org/