diff options
| author | Geoff Liu <cangming.liu@gmail.com> | 2014-11-11 17:42:28 -0800 | 
|---|---|---|
| committer | Geoff Liu <cangming.liu@gmail.com> | 2014-11-11 17:42:28 -0800 | 
| commit | 1761ec868a2aedc1d7ed6bc3d4879c0662050923 (patch) | |
| tree | 8a579b87524d0be9f0ed116731a6d90768ced393 /ruby.html.markdown | |
| parent | e784f52d33475b0cba059a0c07ad01b0e63578a9 (diff) | |
| parent | ad951f2615175b917b7410e667ef91d119468c5a (diff) | |
Merge
Diffstat (limited to 'ruby.html.markdown')
| -rw-r--r-- | ruby.html.markdown | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/ruby.html.markdown b/ruby.html.markdown index 3c67de2e..e58c513d 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -10,6 +10,7 @@ contributors:    - ["Marcos Brizeno", "http://www.about.me/marcosbrizeno"]    - ["Ariel Krakowski", "http://www.learneroo.com"]    - ["Dzianis Dashkevich", "https://github.com/dskecse"] +  - ["Levi Bostian", "https://github.com/levibostian"]  --- @@ -271,6 +272,19 @@ else  end  #=> "OK job" +# exception handling: +begin +  # code here that might raise an exception +  raise NoMemoryError, 'You ran out of memory.' +rescue NoMemoryError => exception_variable +  puts 'NoMemoryError was raised', exception_variable +rescue RuntimeError => other_exception_variable +  puts 'RuntimeError was raised now' +else  +  puts 'This runs if no exceptions were thrown at all' +ensure  +  puts 'This code always runs no matter what' +end  # Functions | 
