begin
  file = File.open("nonexistent.txt", "r")
rescue Errno::ENOENT
  puts "File not found!"
end