# File tmp/rubies/ruby-3.0.4/lib/timeout.rb, line 32
def self.catch(*args)
exc = new(*args)
exc.instance_variable_set(:@thread, Thread.current)
::Kernel.catch(exc) {yield exc}
end
# File tmp/rubies/ruby-3.0.4/lib/timeout.rb, line 38
def exception(*)
# TODO: use Fiber.current to see if self can be thrown
if self.thread == Thread.current
bt = caller
begin
throw(self, bt)
rescue UncaughtThrowError
end
end
self
end