Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 23 lines (18 sloc) 602 Bytes
#!/usr/bin/env ruby
# Demonstrates how exceptions are handled. The first fiber raises an uncaught
# exception, but it doesn't crash the event loop. Notice that `f2` successfully
# prints "after exception" even though `f1` raised an error.
#
# Expected output:
#
# $ examples/exception.rb
# before exception
# RuntimeError: Hello, exception!
# [prints backtrace]
# after exception
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'eventless'
f1 = Eventless.spawn { puts 'before exception'; raise "Hello, exception!" }
f2 = Eventless.spawn { puts 'after exception' }
f1.join
f2.join
Jump to Line
Something went wrong with that request. Please try again.