##// END OF EJS Templates
error: remove superfluous pass statements
Augie Fackler -
r26693:338af851 default
parent child Browse files
Show More
@@ -1,221 +1,216 b''
1 1 # error.py - Mercurial exceptions
2 2 #
3 3 # Copyright 2005-2008 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 """Mercurial exceptions.
9 9
10 10 This allows us to catch exceptions at higher levels without forcing
11 11 imports.
12 12 """
13 13
14 14 from __future__ import absolute_import
15 15
16 16 # Do not import anything here, please
17 17
18 18 class HintException(Exception):
19 19 def __init__(self, *args, **kw):
20 20 Exception.__init__(self, *args)
21 21 self.hint = kw.get('hint')
22 22
23 23 class RevlogError(HintException):
24 24 pass
25 25
26 26 class FilteredIndexError(IndexError):
27 27 pass
28 28
29 29 class LookupError(RevlogError, KeyError):
30 30 def __init__(self, name, index, message):
31 31 self.name = name
32 32 self.index = index
33 33 # this can't be called 'message' because at least some installs of
34 34 # Python 2.6+ complain about the 'message' property being deprecated
35 35 self.lookupmessage = message
36 36 if isinstance(name, str) and len(name) == 20:
37 37 from .node import short
38 38 name = short(name)
39 39 RevlogError.__init__(self, '%s@%s: %s' % (index, name, message))
40 40
41 41 def __str__(self):
42 42 return RevlogError.__str__(self)
43 43
44 44 class FilteredLookupError(LookupError):
45 45 pass
46 46
47 47 class ManifestLookupError(LookupError):
48 48 pass
49 49
50 50 class CommandError(Exception):
51 51 """Exception raised on errors in parsing the command line."""
52 52
53 53 class InterventionRequired(Exception):
54 54 """Exception raised when a command requires human intervention."""
55 55
56 56 class Abort(HintException):
57 57 """Raised if a command needs to print an error and exit."""
58 pass
59 58
60 59 class HookLoadError(Abort):
61 60 """raised when loading a hook fails, aborting an operation
62 61
63 62 Exists to allow more specialized catching."""
64 pass
65 63
66 64 class HookAbort(Abort):
67 65 """raised when a validation hook fails, aborting an operation
68 66
69 67 Exists to allow more specialized catching."""
70 pass
71 68
72 69 class ConfigError(Abort):
73 70 """Exception raised when parsing config files"""
74 71
75 72 class UpdateAbort(Abort):
76 73 """Raised when an update is aborted for destination issue"""
77 74
78 75 class OutOfBandError(Exception):
79 76 """Exception raised when a remote repo reports failure"""
80 77
81 78 def __init__(self, *args, **kw):
82 79 Exception.__init__(self, *args)
83 80 self.hint = kw.get('hint')
84 81
85 82 class ParseError(Exception):
86 83 """Raised when parsing config files and {rev,file}sets (msg[, pos])"""
87 84
88 85 class UnknownIdentifier(ParseError):
89 86 """Exception raised when a {rev,file}set references an unknown identifier"""
90 87
91 88 def __init__(self, function, symbols):
92 89 from .i18n import _
93 90 ParseError.__init__(self, _("unknown identifier: %s") % function)
94 91 self.function = function
95 92 self.symbols = symbols
96 93
97 94 class RepoError(HintException):
98 95 pass
99 96
100 97 class RepoLookupError(RepoError):
101 98 pass
102 99
103 100 class FilteredRepoLookupError(RepoLookupError):
104 101 pass
105 102
106 103 class CapabilityError(RepoError):
107 104 pass
108 105
109 106 class RequirementError(RepoError):
110 107 """Exception raised if .hg/requires has an unknown entry."""
111 pass
112 108
113 109 class LockError(IOError):
114 110 def __init__(self, errno, strerror, filename, desc):
115 111 IOError.__init__(self, errno, strerror, filename)
116 112 self.desc = desc
117 113
118 114 class LockHeld(LockError):
119 115 def __init__(self, errno, filename, desc, locker):
120 116 LockError.__init__(self, errno, 'Lock held', filename, desc)
121 117 self.locker = locker
122 118
123 119 class LockUnavailable(LockError):
124 120 pass
125 121
126 122 # LockError is for errors while acquiring the lock -- this is unrelated
127 123 class LockInheritanceContractViolation(RuntimeError):
128 124 pass
129 125
130 126 class ResponseError(Exception):
131 127 """Raised to print an error with part of output and exit."""
132 128
133 129 class UnknownCommand(Exception):
134 130 """Exception raised if command is not in the command table."""
135 131
136 132 class AmbiguousCommand(Exception):
137 133 """Exception raised if command shortcut matches more than one command."""
138 134
139 135 # derived from KeyboardInterrupt to simplify some breakout code
140 136 class SignalInterrupt(KeyboardInterrupt):
141 137 """Exception raised on SIGTERM and SIGHUP."""
142 138
143 139 class SignatureError(Exception):
144 140 pass
145 141
146 142 class PushRaced(RuntimeError):
147 143 """An exception raised during unbundling that indicate a push race"""
148 144
149 145 # bundle2 related errors
150 146 class BundleValueError(ValueError):
151 147 """error raised when bundle2 cannot be processed"""
152 148
153 149 class BundleUnknownFeatureError(BundleValueError):
154 150 def __init__(self, parttype=None, params=(), values=()):
155 151 self.parttype = parttype
156 152 self.params = params
157 153 self.values = values
158 154 if self.parttype is None:
159 155 msg = 'Stream Parameter'
160 156 else:
161 157 msg = parttype
162 158 entries = self.params
163 159 if self.params and self.values:
164 160 assert len(self.params) == len(self.values)
165 161 entries = []
166 162 for idx, par in enumerate(self.params):
167 163 val = self.values[idx]
168 164 if val is None:
169 165 entries.append(val)
170 166 else:
171 167 entries.append("%s=%r" % (par, val))
172 168 if entries:
173 169 msg = '%s - %s' % (msg, ', '.join(entries))
174 170 ValueError.__init__(self, msg)
175 171
176 172 class ReadOnlyPartError(RuntimeError):
177 173 """error raised when code tries to alter a part being generated"""
178 pass
179 174
180 175 class PushkeyFailed(Abort):
181 176 """error raised when a pushkey part failed to update a value"""
182 177
183 178 def __init__(self, partid, namespace=None, key=None, new=None, old=None,
184 179 ret=None):
185 180 self.partid = partid
186 181 self.namespace = namespace
187 182 self.key = key
188 183 self.new = new
189 184 self.old = old
190 185 self.ret = ret
191 186 # no i18n expected to be processed into a better message
192 187 Abort.__init__(self, 'failed to update value for "%s/%s"'
193 188 % (namespace, key))
194 189
195 190 class CensoredNodeError(RevlogError):
196 191 """error raised when content verification fails on a censored node
197 192
198 193 Also contains the tombstone data substituted for the uncensored data.
199 194 """
200 195
201 196 def __init__(self, filename, node, tombstone):
202 197 from .node import short
203 198 RevlogError.__init__(self, '%s:%s' % (filename, short(node)))
204 199 self.tombstone = tombstone
205 200
206 201 class CensoredBaseError(RevlogError):
207 202 """error raised when a delta is rejected because its base is censored
208 203
209 204 A delta based on a censored revision must be formed as single patch
210 205 operation which replaces the entire base with new content. This ensures
211 206 the delta may be applied by clones which have not censored the base.
212 207 """
213 208
214 209 class InvalidBundleSpecification(Exception):
215 210 """error raised when a bundle specification is invalid.
216 211
217 212 This is used for syntax errors as opposed to support errors.
218 213 """
219 214
220 215 class UnsupportedBundleSpecification(Exception):
221 216 """error raised when a bundle specification is not supported."""
General Comments 0
You need to be logged in to leave comments. Login now