127
127
def __str__(self):
129
return self.__doc__ % self.__dict__
129
# __str__() should always return a 'str' object
130
# never a 'unicode' object.
131
s = self.__doc__ % self.__dict__
132
if isinstance(s, unicode):
133
return s.encode('utf8')
130
135
except (NameError, ValueError, KeyError), e:
131
136
return 'Unprintable exception %s: %s' \
132
137
% (self.__class__.__name__, str(e))
197
202
# BzrCommandError, and non-UI code should not throw a subclass of
198
203
# BzrCommandError. ADHB 20051211
199
204
def __init__(self, msg):
205
# Object.__str__() must return a real string
206
# returning a Unicode string is a python error.
207
if isinstance(msg, unicode):
208
self.msg = msg.encode('utf8')
202
212
def __str__(self):
312
322
self.function = function
325
class InaccessibleParent(PathError):
326
"""Parent not accessible given base %(base)s and relative path %(path)s"""
328
def __init__(self, path, base):
329
PathError.__init__(self, path)
315
333
class NoRepositoryPresent(BzrNewError):
316
334
"""No repository present: %(path)r"""
317
335
def __init__(self, bzrdir):
1053
1071
"""Not a bzr revision-bundle: %(text)r"""
1055
1073
def __init__(self, text):
1059
class BadBundle(Exception): pass
1062
class MalformedHeader(BadBundle): pass
1065
class MalformedPatches(BadBundle): pass
1068
class MalformedFooter(BadBundle): pass
1074
BzrNewError.__init__(self)
1078
class BadBundle(BzrNewError):
1079
"""Bad bzr revision-bundle: %(text)r"""
1081
def __init__(self, text):
1082
BzrNewError.__init__(self)
1086
class MalformedHeader(BadBundle):
1087
"""Malformed bzr revision-bundle header: %(text)r"""
1089
def __init__(self, text):
1090
BzrNewError.__init__(self)
1094
class MalformedPatches(BadBundle):
1095
"""Malformed patches in bzr revision-bundle: %(text)r"""
1097
def __init__(self, text):
1098
BzrNewError.__init__(self)
1102
class MalformedFooter(BadBundle):
1103
"""Malformed footer in bzr revision-bundle: %(text)r"""
1105
def __init__(self, text):
1106
BzrNewError.__init__(self)
1109
class UnsupportedEOLMarker(BadBundle):
1110
"""End of line marker was not \\n in bzr revision-bundle"""
1113
BzrNewError.__init__(self)