PHP 8.2.31
Preview: errors.rb Size: 4.62 KB
/proc/thread-self/root/opt/alt/ruby25/lib64/ruby/2.5.0/rubygems/errors.rb

# frozen_string_literal: true
#--
# This file contains all the various exceptions and other errors that are used
# inside of RubyGems.
#
# DOC: Confirm _all_
#++

module Gem
  ##
  # Raised when RubyGems is unable to load or activate a gem.  Contains the
  # name and version requirements of the gem that either conflicts with
  # already activated gems or that RubyGems is otherwise unable to activate.

  class LoadError < ::LoadError
    # Name of gem
    attr_accessor :name

    # Version requirement of gem
    attr_accessor :requirement
  end

  ##
  # Raised when trying to activate a gem, and that gem does not exist on the
  # system.  Instead of rescuing from this class, make sure to rescue from the
  # superclass Gem::LoadError to catch all types of load errors.
  class MissingSpecError < Gem::LoadError
    def initialize name, requirement
      @name        = name
      @requirement = requirement
    end

    def message # :nodoc:
      build_message +
        "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}', execute `gem env` for more information"
    end

    private

    def build_message
      total = Gem::Specification.stubs.size
      "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
    end
  end

  ##
  # Raised when trying to activate a gem, and the gem exists on the system, but
  # not the requested version. Instead of rescuing from this class, make sure to
  # rescue from the superclass Gem::LoadError to catch all types of load errors.
  class MissingSpecVersionError < MissingSpecError
    attr_reader :specs

    def initialize name, requirement, specs
      super(name, requirement)
      @specs = specs
    end

    private

    def build_message
      if name == "bundler" && message = Gem::BundlerVersionFinder.missing_version_message
        return message
      end
      names = specs.map(&:full_name)
      "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ','}]\n"
    end
  end

  # Raised when there are conflicting gem specs loaded

  class ConflictError < LoadError

    ##
    # A Hash mapping conflicting specifications to the dependencies that
    # caused the conflict

    attr_reader :conflicts

    ##
    # The specification that had the conflict

    attr_reader :target

    def initialize target, conflicts
      @target    = target
      @conflicts = conflicts
      @name      = target.name

      reason = conflicts.map { |act, dependencies|
        "#{act.full_name} conflicts with #{dependencies.join(", ")}"
      }.join ", "

      # TODO: improve message by saying who activated `con`

      super("Unable to activate #{target.full_name}, because #{reason}")
    end
  end

  class ErrorReason; end

  # Generated when trying to lookup a gem to indicate that the gem
  # was found, but that it isn't usable on the current platform.
  #
  # fetch and install read these and report them to the user to aid
  # in figuring out why a gem couldn't be installed.
  #
  class PlatformMismatch < ErrorReason

    ##
    # the name of the gem
    attr_reader :name

    ##
    # the version
    attr_reader :version

    ##
    # The platforms that are mismatched
    attr_reader :platforms

    def initialize(name, version)
      @name = name
      @version = version
      @platforms = []
    end

    ##
    # append a platform to the list of mismatched platforms.
    #
    # Platforms are added via this instead of injected via the constructor
    # so that we can loop over a list of mismatches and just add them rather
    # than perform some kind of calculation mismatch summary before creation.
    def add_platform(platform)
      @platforms << platform
    end

    ##
    # A wordy description of the error.
    def wordy
      "Found %s (%s), but was for platform%s %s" %
        [@name,
         @version,
         @platforms.size == 1 ? '' : 's',
         @platforms.join(' ,')]
    end
  end

  ##
  # An error that indicates we weren't able to fetch some
  # data from a source

  class SourceFetchProblem < ErrorReason

    ##
    # Creates a new SourceFetchProblem for the given +source+ and +error+.

    def initialize(source, error)
      @source = source
      @error = error
    end

    ##
    # The source that had the fetch problem.

    attr_reader :source

    ##
    # The fetch error which is an Exception subclass.

    attr_reader :error

    ##
    # An English description of the error.

    def wordy
      @source.uri.password = 'REDACTED' unless @source.uri.password.nil?
      "Unable to download data from #{@source.uri} - #{@error.message}"
    end

    ##
    # The "exception" alias allows you to call raise on a SourceFetchProblem.

    alias exception error
  end
end

Directory Contents

Dirs: 11 × Files: 61

Name Size Perms Modified Actions
commands DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
core_ext DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
ext DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
package DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
request DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
resolver DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
security DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
source DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
ssl_certs DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
util DIR
- drwxr-xr-x 2024-03-03 22:47:52
Edit Download
3.02 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
7.36 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.69 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
13.98 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.77 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.66 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
12.51 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.46 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
8.38 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
14.17 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
5.55 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.73 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
3.06 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.62 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
6.39 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
461 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.37 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.18 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
11.06 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
25.11 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.41 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
337 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
311 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
6.89 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
3.40 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.38 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.41 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
16.47 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
3.80 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.72 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
6.25 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
300 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
793 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
7.74 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
11.67 KB lrw-r--r-- 2023-07-26 14:54:23
Edit Download
8.66 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
10.77 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
6.59 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
9.53 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.15 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
21.13 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.06 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
22.72 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
5.42 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.53 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
275 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
272 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
82.56 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
6.47 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.86 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.12 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
40.33 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
8.63 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
1.88 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
8.74 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
792 B lrw-r--r-- 2021-04-05 11:46:35
Edit Download
14.54 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.57 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
4.23 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
11.97 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download
2.03 KB lrw-r--r-- 2021-04-05 11:46:35
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).