diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 06:52:18 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 06:52:18 +0000 |
commit | 9694bb8cac12969300692dac5a1cf7aa4e3a46cd (patch) | |
tree | c3cb423d701f7049ba9382de052e2a937cd1302d /lib/rubygems/exceptions.rb | |
parent | 3f606b7063fc7a8b191556365ad343a314719a8d (diff) |
* lib/rubygems*: Updated to RubyGems 2.0
* test/rubygems*: ditto.
* common.mk (prelude): Updated for RubyGems 2.0 source rearrangement.
* tool/change_maker.rb: Allow invalid UTF-8 characters in source
files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/exceptions.rb')
-rw-r--r-- | lib/rubygems/exceptions.rb | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb index 55d67f9125..ff389b320b 100644 --- a/lib/rubygems/exceptions.rb +++ b/lib/rubygems/exceptions.rb @@ -1,7 +1,14 @@ +# TODO: the documentation in here is terrible. +# +# Each exception needs a brief description and the scenarios where it is +# likely to be raised + ## # Base exception class for RubyGems. All exception raised by RubyGems are a # subclass of this one. -class Gem::Exception < RuntimeError; end +class Gem::Exception < RuntimeError + attr_accessor :source_exception +end class Gem::CommandLineError < Gem::Exception; end @@ -24,11 +31,18 @@ class Gem::EndOfYAMLException < Gem::Exception; end ## # Signals that a file permission error is preventing the user from -# installing in the requested directories. +# operating on the given directory. + class Gem::FilePermissionError < Gem::Exception - def initialize(path) - super("You don't have write permissions into the #{path} directory.") + + attr_reader :directory + + def initialize directory + @directory = directory + + super "You don't have write permissions for the #{directory} directory." end + end ## @@ -37,9 +51,12 @@ class Gem::FormatException < Gem::Exception attr_accessor :file_path end -class Gem::GemNotFoundException < Gem::Exception - def initialize(msg, name=nil, version=nil, errors=nil) - super msg +class Gem::GemNotFoundException < Gem::Exception; end + +class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException + def initialize(name, version, errors=nil) + super "Could not find a valid gem '#{name}' (#{version}) locally or in a repository" + @name = name @version = version @errors = errors @@ -89,3 +106,4 @@ class Gem::SystemExitException < SystemExit end end + |