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"""
283
class InvalidNormalization(PathError):
284
"""Path %(path)r is not unicode normalized"""
276
287
# TODO: This is given a URL; we try to unescape it but doing that from inside
277
288
# the exception object is a bit undesirable.
278
289
# TODO: Probably this behavior of should be a common superclass
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"""
747
752
class ConflictsInTree(BzrError):
965
970
"""A nested progress bar was not 'finished' correctly."""
973
class InvalidProgressBarType(BzrNewError):
974
"""Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
975
Select one of: %(valid_types)s"""
977
def __init__(self, bar_type, valid_types):
978
BzrNewError.__init__(self, bar_type=bar_type, valid_types=valid_types)
968
981
class UnsupportedOperation(BzrNewError):
969
982
"""The method %(mname)s is not supported on objects of type %(tname)s."""
970
983
def __init__(self, method, method_self):