~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Robert Collins
  • Date: 2006-09-17 21:03:04 UTC
  • mfrom: (2018 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2019.
  • Revision ID: robertc@robertcollins.net-20060917210304-3a697132f5fb68ac
Merge bzr.dev.

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
 
790
811
        BzrNewError.__init__(self)
791
812
 
792
813
 
 
814
class SmartProtocolError(TransportError):
 
815
    """Generic bzr smart protocol error: %(details)s"""
 
816
 
 
817
    def __init__(self, details):
 
818
        self.details = details
 
819
 
 
820
 
793
821
# A set of semi-meaningful errors which can be thrown
794
822
class TransportNotPossible(TransportError):
795
823
    """Transport operation not possible: %(msg)s %(orig_error)%"""
1168
1196
        BadInventoryFormat.__init__(self, msg=msg)
1169
1197
 
1170
1198
 
 
1199
class NoSmartServer(NotBranchError):
 
1200
    """No smart server available at %(url)s"""
 
1201
 
 
1202
    def __init__(self, url):
 
1203
        self.url = url
 
1204
 
 
1205
 
1171
1206
class UnknownSSH(BzrNewError):
1172
1207
    """Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
1173
1208
 
1182
1217
    def __init__(self, revision_id):
1183
1218
        BzrNewError.__init__(self)
1184
1219
        self.revision_id = revision_id
 
1220
 
 
1221
 
 
1222
class IllegalUseOfScopeReplacer(BzrNewError):
 
1223
    """ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"""
 
1224
 
 
1225
    is_user_error = False
 
1226
 
 
1227
    def __init__(self, name, msg, extra=None):
 
1228
        BzrNewError.__init__(self)
 
1229
        self.name = name
 
1230
        self.msg = msg
 
1231
        if extra:
 
1232
            self.extra = ': ' + str(extra)
 
1233
        else:
 
1234
            self.extra = ''
 
1235
 
 
1236
 
 
1237
class InvalidImportLine(BzrNewError):
 
1238
    """Not a valid import statement: %(msg)\n%(text)s"""
 
1239
 
 
1240
    is_user_error = False
 
1241
 
 
1242
    def __init__(self, text, msg):
 
1243
        BzrNewError.__init__(self)
 
1244
        self.text = text
 
1245
        self.msg = msg
 
1246
 
 
1247
 
 
1248
class ImportNameCollision(BzrNewError):
 
1249
    """Tried to import an object to the same name as an existing object. %(name)s"""
 
1250
 
 
1251
    is_user_error = False
 
1252
 
 
1253
    def __init__(self, name):
 
1254
        BzrNewError.__init__(self)
 
1255
        self.name = name