~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Aaron Bentley
  • Date: 2006-09-21 15:58:05 UTC
  • mfrom: (2025.1.1 check-parents)
  • mto: This revision was merged to the branch mainline in revision 2048.
  • Revision ID: abentley@panoramicfeedback.com-20060921155805-5b3579f9994cd307
Merge check-parent fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
            if isinstance(s, unicode):
133
133
                return s.encode('utf8')
134
134
            return s
135
 
        except (NameError, ValueError, KeyError), e:
136
 
            return 'Unprintable exception %s: %s' \
137
 
                % (self.__class__.__name__, str(e))
 
135
        except (TypeError, NameError, ValueError, KeyError), e:
 
136
            return 'Unprintable exception %s(%r): %s' \
 
137
                % (self.__class__.__name__,
 
138
                   self.__dict__, str(e))
 
139
 
 
140
 
 
141
class AlreadyBuilding(BzrNewError):
 
142
    """The tree builder is already building a tree."""
138
143
 
139
144
 
140
145
class BzrCheckError(BzrNewError):
191
196
        self.base = base
192
197
 
193
198
 
 
199
class NotBuilding(BzrNewError):
 
200
    """Not currently building a tree."""
 
201
 
 
202
 
194
203
class NotLocalUrl(BzrNewError):
195
204
    """%(url)s is not a local path."""
196
205
    
285
294
        PathError.__init__(self, url, extra=extra)
286
295
 
287
296
 
 
297
class ShortReadvError(PathError):
 
298
    """readv() read %(actual)s bytes rather than %(length)s bytes at %(offset)s for %(path)s%(extra)s"""
 
299
 
 
300
    is_user_error = False
 
301
 
 
302
    def __init__(self, path, offset, length, actual, extra=None):
 
303
        PathError.__init__(self, path, extra=extra)
 
304
        self.offset = offset
 
305
        self.length = length
 
306
        self.actual = actual
 
307
 
 
308
 
288
309
class PathNotChild(BzrNewError):
289
310
    """Path %(path)r is not a child of path %(base)r%(extra)s"""
290
311
 
768
789
        self.how = how
769
790
 
770
791
 
 
792
class KnitTextsDiffer(KnitError):
 
793
    """Knit texts for version %(version) differ"""
 
794
 
 
795
    def __init__(self, version_id):
 
796
        KnitError.__init__(self)
 
797
        self.version_id = version_id
 
798
 
 
799
 
771
800
class NoSuchExportFormat(BzrNewError):
772
801
    """Export format %(format)r not supported"""
773
802
    def __init__(self, format):
790
819
        BzrNewError.__init__(self)
791
820
 
792
821
 
 
822
class SmartProtocolError(TransportError):
 
823
    """Generic bzr smart protocol error: %(details)s"""
 
824
 
 
825
    def __init__(self, details):
 
826
        self.details = details
 
827
 
 
828
 
793
829
# A set of semi-meaningful errors which can be thrown
794
830
class TransportNotPossible(TransportError):
795
831
    """Transport operation not possible: %(msg)s %(orig_error)%"""
1177
1213
        BadInventoryFormat.__init__(self, msg=msg)
1178
1214
 
1179
1215
 
 
1216
class NoSmartServer(NotBranchError):
 
1217
    """No smart server available at %(url)s"""
 
1218
 
 
1219
    def __init__(self, url):
 
1220
        self.url = url
 
1221
 
 
1222
 
1180
1223
class UnknownSSH(BzrNewError):
1181
1224
    """Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
1182
1225
 
1191
1234
    def __init__(self, revision_id):
1192
1235
        BzrNewError.__init__(self)
1193
1236
        self.revision_id = revision_id
 
1237
 
 
1238
 
 
1239
class IllegalUseOfScopeReplacer(BzrNewError):
 
1240
    """ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"""
 
1241
 
 
1242
    is_user_error = False
 
1243
 
 
1244
    def __init__(self, name, msg, extra=None):
 
1245
        BzrNewError.__init__(self)
 
1246
        self.name = name
 
1247
        self.msg = msg
 
1248
        if extra:
 
1249
            self.extra = ': ' + str(extra)
 
1250
        else:
 
1251
            self.extra = ''
 
1252
 
 
1253
 
 
1254
class InvalidImportLine(BzrNewError):
 
1255
    """Not a valid import statement: %(msg)\n%(text)s"""
 
1256
 
 
1257
    is_user_error = False
 
1258
 
 
1259
    def __init__(self, text, msg):
 
1260
        BzrNewError.__init__(self)
 
1261
        self.text = text
 
1262
        self.msg = msg
 
1263
 
 
1264
 
 
1265
class ImportNameCollision(BzrNewError):
 
1266
    """Tried to import an object to the same name as an existing object. %(name)s"""
 
1267
 
 
1268
    is_user_error = False
 
1269
 
 
1270
    def __init__(self, name):
 
1271
        BzrNewError.__init__(self)
 
1272
        self.name = name