rescue is a binary operator which takes two expressions, so you need
to code like:
require(“file”) rescue puts(“oops”)
Besides, require raises LoadError, which is not a subclass of
StandardError, that means it cannot be caught by rescue clause without
specifying exception class explicitly. rescue modifier is for casual
exception handling after all.
The syntax restriction can be relaxed. Let me see what I can.
matz.
···
In message “rescue modifier with require” on 03/02/25, “Hal E. Fulton” hal9000@hypermetrics.com writes: