Class: Timeout::Error (Ruby 2.7.3)
Description: Class : Timeout::Error - Ruby 2.7.3

### Home Classes Methods

### In Files

- timeout.rb

### Parent

RuntimeError

### Methods

- ::catch
- #exception

### Class/Module Index

Quicksearch

- Object
- Object::TimeoutError
- Timeout
- Timeout::Error
- Timeout::TimeoutError

No matching classes.

# Timeout::Error

Raised by `Timeout.timeout` when the block times out.

### Attributes

thread[R]

### Public Class Methods

catch(*args) click to toggle source

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

### Public Instance Methods

exception(*) click to toggle source

                   # File 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