class Google::Cloud::Env::LazyValue

def raise_expiring_error lifetime, error, *args

Parameters:
  • args (Array) -- any arguments to pass to an error constructor
  • error (String, Exception, Class) -- the error to raise
  • lifetime (Numeric) -- timeout in seconds
def raise_expiring_error lifetime, error, *args
  raise error unless lifetime
  raise ExpiringError, lifetime if error.equal? $ERROR_INFO
  if error.is_a?(Class) && error.ancestors.include?(Exception)
    error = error.new(*args)
  elsif !error.is_a? Exception
    error = RuntimeError.new error.to_s
  end
  begin
    raise error
  rescue error.class
    raise ExpiringError, lifetime
  end
end