Sha256: 15099c6b9d53be06f2631d8f318a55357cbee2c76203bb421abdb7a5f3a8b070

Contents?: true

Size: 494 Bytes

Versions: 3

Compression:

Stored size: 494 Bytes

Contents

require './lib/enhanced_errors'
require 'awesome_print' # Optional, for better output

EnhancedErrors.enhance!

def foo
  begin
    myvar = 0
    @myinstance = 10
    foo = @myinstance / myvar
  rescue => e
    puts e.message
  end
end

def baz
  i.dontexist
end

def boo
    seeme = 'youshould'
    baz
  rescue => e
    puts e.message
end


puts "\n--- Example with raise ---\n\n\n"

foo

puts "\n--- Example with raise and rescue (requires ruby 3.2 or greater to see rescue) ---\n\n\n"

boo

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enhanced_errors-0.1.6 examples/division_by_zero_example.rb
enhanced_errors-0.1.5 examples/division_by_zero_example.rb
enhanced_errors-0.1.4 examples/division_by_zero_example.rb