Skip to content

Instantly share code, notes, and snippets.

@benelog
Created January 4, 2013 08:27
Show Gist options
  • Save benelog/4450896 to your computer and use it in GitHub Desktop.
Save benelog/4450896 to your computer and use it in GitHub Desktop.
Ruby basic
def testException
begin
File.read 'myfile'
rescue SystemCallError => e
puts 'system call failed : ' + e
puts e.class
puts "Backtrace" + e.backtrace.join("\n")
rescue Exceptoin => e
puts 'generics failure of some kind'
else
puts 'nothing failed'
ensure
puts 'this always executes'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment