Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 107 lines (75 sloc) 2.629 kB
bb81071 @drbrain Add TODO for various improvements to RubyGems.
drbrain authored
1 # TODO: the documentation in here is terrible.
2 #
3 # Each exception needs a brief description and the scenarios where it is
4 # likely to be raised
5
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
6 ##
7 # Base exception class for RubyGems. All exception raised by RubyGems are a
8 # subclass of this one.
c041cc5 @evanphx Improve error reporting around bad sources
evanphx authored
9 class Gem::Exception < RuntimeError
10 attr_accessor :source_exception
11 end
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
12
13 class Gem::CommandLineError < Gem::Exception; end
f54d29c @drbrain Pushed dependencies down as far as they could reasonably go.
drbrain authored
14
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
15 class Gem::DependencyError < Gem::Exception; end
f54d29c @drbrain Pushed dependencies down as far as they could reasonably go.
drbrain authored
16
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
17 class Gem::DependencyRemovalException < Gem::Exception; end
f54d29c @drbrain Pushed dependencies down as far as they could reasonably go.
drbrain authored
18
e4bb356 @drbrain Only allow uninstallation of gems from specified local repo.
drbrain authored
19 ##
20 # Raised when attempting to uninstall a gem that isn't in GEM_HOME.
9ab2654 @drbrain Clean up all old gems, instead of most-recent.
drbrain authored
21
22 class Gem::GemNotInHomeException < Gem::Exception
23 attr_accessor :spec
24 end
e4bb356 @drbrain Only allow uninstallation of gems from specified local repo.
drbrain authored
25
42a126e @drbrain Move doc/signing_gems.txt into lib/rubygems/security.rb for great RDoc!
drbrain authored
26 class Gem::DocumentError < Gem::Exception; end
e4bb356 @drbrain Only allow uninstallation of gems from specified local repo.
drbrain authored
27
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
28 ##
29 # Potentially raised when a specification is validated.
30 class Gem::EndOfYAMLException < Gem::Exception; end
31
32 ##
33 # Signals that a file permission error is preventing the user from
bfafdb4 @drbrain - Gem::DocManager is no longer used by RubyGems. Gem::RDoc is now used.
drbrain authored
34 # operating on the given directory.
35
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
36 class Gem::FilePermissionError < Gem::Exception
bfafdb4 @drbrain - Gem::DocManager is no longer used by RubyGems. Gem::RDoc is now used.
drbrain authored
37
38 attr_reader :directory
39
40 def initialize directory
41 @directory = directory
42
43 super "You don't have write permissions for the #{directory} directory."
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
44 end
bfafdb4 @drbrain - Gem::DocManager is no longer used by RubyGems. Gem::RDoc is now used.
drbrain authored
45
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
46 end
f54d29c @drbrain Pushed dependencies down as far as they could reasonably go.
drbrain authored
47
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
48 ##
49 # Used to raise parsing and loading errors
50 class Gem::FormatException < Gem::Exception
51 attr_accessor :file_path
f54d29c @drbrain Pushed dependencies down as far as they could reasonably go.
drbrain authored
52 end
53
d7f57cb @evanphx Track and report more information about why a gem couldn't be installed
evanphx authored
54 class Gem::GemNotFoundException < Gem::Exception
55 def initialize(msg, name=nil, version=nil, errors=nil)
56 super msg
57 @name = name
58 @version = version
59 @errors = errors
60 end
61
62 attr_reader :name, :version, :errors
63 end
4d7616a @drbrain Put (almost) all of the exceptions into one place.
drbrain authored
64
65 class Gem::InstallError < Gem::Exception; end
66
67 ##
68 # Potentially raised when a specification is validated.
69 class Gem::InvalidSpecificationException < Gem::Exception; end
70
71 class Gem::OperationNotSupportedError < Gem::Exception; end
72
73 ##
74 # Signals that a remote operation cannot be conducted, probably due to not
75 # being connected (or just not finding host).
76 #--
77 # TODO: create a method that tests connection to the preferred gems server.
78 # All code dealing with remote operations will want this. Failure in that
79 # method should raise this error.
80 class Gem::RemoteError < Gem::Exception; end
81
82 class Gem::RemoteInstallationCancelled < Gem::Exception; end
83
84 class Gem::RemoteInstallationSkipped < Gem::Exception; end
85
86 ##
87 # Represents an error communicating via HTTP.
88 class Gem::RemoteSourceException < Gem::Exception; end
89
90 class Gem::VerificationError < Gem::Exception; end
91
84f1b84 @drbrain Add Gem::SystemExitException, remove unused terminate_interaction\!
drbrain authored
92 ##
93 # Raised to indicate that a system exit should occur with the specified
94 # exit_code
d0ea491 @drbrain Add --installed option to QueryCommand
drbrain authored
95
84f1b84 @drbrain Add Gem::SystemExitException, remove unused terminate_interaction\!
drbrain authored
96 class Gem::SystemExitException < SystemExit
97 attr_accessor :exit_code
d0ea491 @drbrain Add --installed option to QueryCommand
drbrain authored
98
99 def initialize(exit_code)
100 @exit_code = exit_code
101
102 super "Exiting RubyGems with exit_code #{exit_code}"
103 end
104
84f1b84 @drbrain Add Gem::SystemExitException, remove unused terminate_interaction\!
drbrain authored
105 end
c041cc5 @evanphx Improve error reporting around bad sources
evanphx authored
106
Something went wrong with that request. Please try again.