1
1
# Copyright (C) 2005, 2006 Canonical
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
11
# GNU General Public License for more details.
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
258
258
self.args.extend(args)
261
class UnsupportedProtocol(PathError):
262
"""Unsupported protocol for url "%(path)s"%(extra)s"""
264
def __init__(self, url, extra):
265
PathError.__init__(self, url, extra=extra)
261
268
class PathNotChild(BzrNewError):
262
269
"""Path %(path)r is not a child of path %(base)r%(extra)s"""
293
304
(use bzr checkout if you wish to build a working tree): %(path)s"""
307
class AtomicFileAlreadyClosed(PathError):
308
"""'%(function)s' called on an AtomicFile after it was closed: %(path)s"""
310
def __init__(self, path, function):
311
PathError.__init__(self, path=path, extra=None)
312
self.function = function
315
class InaccessibleParent(PathError):
316
"""Parent not accessible given base %(base)s and relative path %(path)s"""
318
def __init__(self, path, base):
319
PathError.__init__(self, path)
296
323
class NoRepositoryPresent(BzrNewError):
297
324
"""No repository present: %(path)r"""
298
325
def __init__(self, bzrdir):
710
737
self.format = format
713
class TransportError(BzrError):
714
"""All errors thrown by Transport implementations should derive
740
class TransportError(BzrNewError):
741
"""Transport error: %(msg)s %(orig_error)s"""
717
743
def __init__(self, msg=None, orig_error=None):
718
744
if msg is None and orig_error is not None:
719
745
msg = str(orig_error)
720
BzrError.__init__(self, msg)
746
if orig_error is None:
722
751
self.orig_error = orig_error
752
BzrNewError.__init__(self)
725
755
# A set of semi-meaningful errors which can be thrown
726
756
class TransportNotPossible(TransportError):
727
"""This is for transports where a specific function is explicitly not
728
possible. Such as pushing files to an HTTP server.
757
"""Transport operation not possible: %(msg)s %(orig_error)%"""
733
760
class ConnectionError(TransportError):
734
"""A connection problem prevents file retrieval.
735
This does not indicate whether the file exists or not; it indicates that a
736
precondition for requesting the file was not met.
738
def __init__(self, msg=None, orig_error=None):
739
TransportError.__init__(self, msg=msg, orig_error=orig_error)
761
"""Connection error: %(msg)s %(orig_error)s"""
742
764
class ConnectionReset(TransportError):
743
"""The connection has been closed."""
765
"""Connection closed: %(msg)s %(orig_error)s"""
768
class InvalidRange(TransportError):
769
"""Invalid range access."""
771
def __init__(self, path, offset):
772
TransportError.__init__(self, ("Invalid range access in %s at %d"
776
class InvalidHttpResponse(TransportError):
777
"""Invalid http response for %(path)s: %(msg)s"""
779
def __init__(self, path, msg, orig_error=None):
781
TransportError.__init__(self, msg, orig_error=orig_error)
784
class InvalidHttpRange(InvalidHttpResponse):
785
"""Invalid http range "%(range)s" for %(path)s: %(msg)s"""
787
def __init__(self, path, range, msg):
789
InvalidHttpResponse.__init__(self, path, msg)
792
class InvalidHttpContentType(InvalidHttpResponse):
793
"""Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s"""
795
def __init__(self, path, ctype, msg):
797
InvalidHttpResponse.__init__(self, path, msg)
747
800
class ConflictsInTree(BzrError):
965
1018
"""A nested progress bar was not 'finished' correctly."""
1021
class InvalidProgressBarType(BzrNewError):
1022
"""Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1023
Select one of: %(valid_types)s"""
1025
def __init__(self, bar_type, valid_types):
1026
BzrNewError.__init__(self, bar_type=bar_type, valid_types=valid_types)
968
1029
class UnsupportedOperation(BzrNewError):
969
1030
"""The method %(mname)s is not supported on objects of type %(tname)s."""
970
1031
def __init__(self, method, method_self):
1000
1061
"""Not a bzr revision-bundle: %(text)r"""
1002
1063
def __init__(self, text):
1006
class BadBundle(Exception): pass
1009
class MalformedHeader(BadBundle): pass
1012
class MalformedPatches(BadBundle): pass
1015
class MalformedFooter(BadBundle): pass
1064
BzrNewError.__init__(self)
1068
class BadBundle(BzrNewError):
1069
"""Bad bzr revision-bundle: %(text)r"""
1071
def __init__(self, text):
1072
BzrNewError.__init__(self)
1076
class MalformedHeader(BadBundle):
1077
"""Malformed bzr revision-bundle header: %(text)r"""
1079
def __init__(self, text):
1080
BzrNewError.__init__(self)
1084
class MalformedPatches(BadBundle):
1085
"""Malformed patches in bzr revision-bundle: %(text)r"""
1087
def __init__(self, text):
1088
BzrNewError.__init__(self)
1092
class MalformedFooter(BadBundle):
1093
"""Malformed footer in bzr revision-bundle: %(text)r"""
1095
def __init__(self, text):
1096
BzrNewError.__init__(self)
1099
class UnsupportedEOLMarker(BadBundle):
1100
"""End of line marker was not \\n in bzr revision-bundle"""
1103
BzrNewError.__init__(self)