fork download
  1. a = 10
  2. b = "42"
  3.  
  4. begin
  5. a + b
  6. rescue Exception => e
  7. puts "Could not add variables a (#{a.class}) and b (#{b.class})"
  8. puts "#{e.errorcode}"
  9. else
  10. puts "a + b is #{a + b}"
  11. end
Runtime error #stdin #stdout #stderr 0.02s 9664KB
stdin
Standard input is empty
stdout
Could not add variables a (Fixnum) and b (String)
stderr
prog.rb:8:in `rescue in <main>': undefined method `errorcode' for #<TypeError: String can't be coerced into Fixnum> (NoMethodError)
	from prog.rb:4:in `<main>'