Created
January 4, 2013 08:27
-
-
Save benelog/4450896 to your computer and use it in GitHub Desktop.
Ruby basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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