module Bundler::SafeCatch::Internal

def self.catch(tag, &block)

def self.catch(tag, &block)
  @recurse_count += 1
  if SAFE_RECURSE_EVERY >= 0 && @recurse_count % SAFE_RECURSE_EVERY == 0
    SAFE_RECURSE_CLASS.new(&block).send(SAFE_RECURSE_START)
  else
    block.call
  end
rescue Result.matcher(tag)
  $!.value
end