异常处理

# any method can throw an error
def method_with_exception()   
    begin
        raise "test exception"
    rescue Exception => e
        # implementation of any partial processing
        # and send error to the calling code        
        raise e
    end
end

begin
    method_with_exception()
rescue Exception => e
    puts "Error: #{e}"
end