在线文档教程
Ruby 2.4

Timeout::Error

class Timeout::Error

父类:RuntimeError

当超时超时时,超时发生。

属性

threadR

公共类方法

catch(* args){| exc | ...}显示源文件

# File lib/timeout.rb, line 29 def self.catch(*args) exc = new(*args) exc.instance_variable_set(:@thread, Thread.current) ::Kernel.catch(exc) {yield exc} end

公共实例方法

例外(*)显示源

# File lib/timeout.rb, line 35 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