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"""
710
721
self.format = format
713
class TransportError(BzrError):
714
"""All errors thrown by Transport implementations should derive
724
class TransportError(BzrNewError):
725
"""Transport error: %(msg)s %(orig_error)s"""
717
727
def __init__(self, msg=None, orig_error=None):
718
728
if msg is None and orig_error is not None:
719
729
msg = str(orig_error)
720
BzrError.__init__(self, msg)
730
if orig_error is None:
722
735
self.orig_error = orig_error
736
BzrNewError.__init__(self)
725
739
# A set of semi-meaningful errors which can be thrown
726
740
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.
741
"""Transport operation not possible: %(msg)s %(orig_error)%"""
733
744
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)
745
"""Connection error: %(msg)s %(orig_error)s"""
742
748
class ConnectionReset(TransportError):
743
"""The connection has been closed."""
749
"""Connection closed: %(msg)s %(orig_error)s"""
752
class InvalidRange(TransportError):
753
"""Invalid range access."""
755
def __init__(self, path, offset):
756
TransportError.__init__(self, ("Invalid range access in %s at %d"
760
class InvalidHttpResponse(TransportError):
761
"""Invalid http response for %(path)s: %(msg)s"""
763
def __init__(self, path, msg, orig_error=None):
765
TransportError.__init__(self, msg, orig_error=orig_error)
768
class InvalidHttpRange(InvalidHttpResponse):
769
"""Invalid http range "%(range)s" for %(path)s: %(msg)s"""
771
def __init__(self, path, range, msg):
773
InvalidHttpResponse.__init__(self, path, msg)
776
class InvalidHttpContentType(InvalidHttpResponse):
777
"""Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s"""
779
def __init__(self, path, ctype, msg):
781
InvalidHttpResponse.__init__(self, path, msg)
747
784
class ConflictsInTree(BzrError):
979
1016
"""A nested progress bar was not 'finished' correctly."""
1019
class InvalidProgressBarType(BzrNewError):
1020
"""Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1021
Select one of: %(valid_types)s"""
1023
def __init__(self, bar_type, valid_types):
1024
BzrNewError.__init__(self, bar_type=bar_type, valid_types=valid_types)
982
1027
class UnsupportedOperation(BzrNewError):
983
1028
"""The method %(mname)s is not supported on objects of type %(tname)s."""
984
1029
def __init__(self, method, method_self):