🏢 PlaceMaker | 25% off for February including new Google Earth data imports!
Learn more
Throw exception when required file does not exist?
-
I wanted to do this:
begin require 'file' rescue # end
But it does work? Why not?
I know I can do it other ways, but I'm just curious if there's a reason for the behavior.
-
rescue with no argument will default to
StandardError
.
What you want is:begin require 'foods' rescue LoadError puts "not there" end
-
Ah! Thank you Adam.
But I think I may just be being too lazy to check if the files exists...
Advertisement