summaryrefslogtreecommitdiff
path: root/lib/rubygems/errors.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-02-14 12:59:03 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-02-14 12:59:03 +0000
commit4ae3df42f723d25b0fe4ba6b2689d607b01c6f48 ()
tree26c5f5cf033f79373e63b10f684df07898b7cd8f /lib/rubygems/errors.rb
parentd1e6304a891fc5e9cc63e50520bdc798fb95b829 (diff)
Merge RubyGems master@9be7858f7f17eae3058204f3c03e4b798ba18b9c
This version contains the some style changes by RuboCop. * https://.com/rubygems/rubygems/commit/9d810be0ede925fb2e3af535848582c3f8e0e72f * https://.com/rubygems/rubygems/commit/61ea98a727fb1b76b6fac52d74107ee4b02aaef2 * https://.com/rubygems/rubygems/commit/795893dce3c5f8540804fc08144cc6a90f086b13 * https://.com/rubygems/rubygems/commit/9be7858f7f17eae3058204f3c03e4b798ba18b9c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/rubygems/errors.rb13
1 files changed, 11 insertions, 2 deletions
@@ -13,11 +13,13 @@ module Gem
# 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
##
@@ -25,6 +27,7 @@ module Gem
# 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
@@ -41,6 +44,7 @@ module Gem
total = Gem::Specification.stubs.size
"Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
end
end
##
@@ -48,6 +52,7 @@ module Gem
# 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)
@@ -64,6 +69,7 @@ module Gem
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
@@ -86,14 +92,15 @@ module Gem
@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
@@ -143,6 +150,7 @@ module Gem
@platforms.size == 1 ? '' : 's',
@platforms.join(' ,')]
end
end
##
@@ -181,5 +189,6 @@ module Gem
# The "exception" alias allows you to call raise on a SourceFetchProblem.
alias exception error
end
end