#!/usr/bin/env ruby def doit_right puts "Doing it right" raise Exception, "Ouch!" end def doit_wrong puts "Doing it wrong" throw Exception, "Ouch!" end begin doit_right rescue Exception => e puts "I have rescued #{e}" end begin doit_wrong rescue Exception => e puts "I have rescued #{e}" end