diff options
author | Hiroshi SHIBATA <[email protected]> | 2020-09-23 21:02:56 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2020-09-23 21:02:56 +0900 |
commit | 31a6eaabc165d8a222e176f2c809d90622d88ec2 (patch) | |
tree | b5333db2c13888ede5062ccd8ecca649ea261b4c /lib/rubygems/errors.rb | |
parent | f56fc720ee8cd4b79824a1c3843058b662a302bd (diff) |
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
Diffstat (limited to 'lib/rubygems/errors.rb')
-rw-r--r-- | lib/rubygems/errors.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb index abee20651e..362a07865f 100644 --- a/lib/rubygems/errors.rb +++ b/lib/rubygems/errors.rb @@ -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, extra_message=nil) @name = name @requirement = requirement @@ -42,6 +45,7 @@ module Gem total = Gem::Specification.stubs.size "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n" end + end ## @@ -49,6 +53,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) @@ -65,11 +70,13 @@ 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 class ConflictError < LoadError + ## # A Hash mapping conflicting specifications to the dependencies that # caused the conflict @@ -94,6 +101,7 @@ module Gem super("Unable to activate #{target.full_name}, because #{reason}") end + end class ErrorReason; end @@ -105,6 +113,7 @@ module Gem # in figuring out why a gem couldn't be installed. # class PlatformMismatch < ErrorReason + ## # the name of the gem attr_reader :name @@ -142,6 +151,7 @@ module Gem @platforms.size == 1 ? '' : 's', @platforms.join(' ,')] end + end ## @@ -149,6 +159,7 @@ module Gem # data from a source class SourceFetchProblem < ErrorReason + ## # Creates a new SourceFetchProblem for the given +source+ and +error+. @@ -179,5 +190,6 @@ module Gem # The "exception" alias allows you to call raise on a SourceFetchProblem. alias exception error + end end |