Sha256: 0e9ec8934277fb73d99f9ec547c1078ca2e21c1b50b86c89049c894749ca2ce4
Contents?: true
Size: 598 Bytes
Versions: 32
Compression:
Stored size: 598 Bytes
Contents
require 'timeout' class Puppeteer::TimeoutHelper # @param timeout_ms [String|Integer|nil] # @param default_timeout_ms [Integer] def initialize(task_name, timeout_ms:, default_timeout_ms:) @task_name = task_name @timeout_ms = (timeout_ms || default_timeout_ms).to_i end def with_timeout(&block) if @timeout_ms > 0 begin Timeout.timeout(@timeout_ms / 1000.0, &block) rescue Timeout::Error raise Puppeteer::TimeoutError.new("waiting for #{@task_name} failed: timeout #{@timeout_ms}ms exceeded") end else block.call end end end
Version data entries
32 entries across 32 versions & 1 rubygems