123456789_123456789_123456789_123456789_123456789_

Exception: Timeout::Error

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, RuntimeError
Instance Chain:
self, RuntimeError
Inherits: RuntimeError
Defined in: lib/timeout.rb

Overview

Raised by #timeout when the block times out.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Class Method Details

.catch(*args)

[ GitHub ]

  
# File 'lib/timeout.rb', line 30

def self.catch(*args)
  exc = new(*args)
  exc.instance_variable_set(:@thread, Thread.current)
  ::Kernel.catch(exc) {yield exc}
end

Instance Attribute Details

#thread (readonly)

[ GitHub ]

  
# File 'lib/timeout.rb', line 28

attr_reader :thread

Instance Method Details

#exception

[ GitHub ]

  
# File 'lib/timeout.rb', line 36

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