~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to errors.py

  • Committer: Aaron Bentley
  • Date: 2008-04-11 00:03:51 UTC
  • Revision ID: aaron@aaronbentley.com-20080411000351-dmbvgmanygnphzgp
Add escaping to HTML output

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005 Aaron Bentley, 2006 Michael Ellerman
2
 
# <aaron.bentley@utoronto.ca>
 
2
# <aaron@aaronbentley.com>
3
3
#
4
4
#    This program is free software; you can redistribute it and/or modify
5
5
#    it under the terms of the GNU General Public License as published by
27
27
    class CommandError(Exception):
28
28
        pass
29
29
 
30
 
class PatchFailed(Exception):
31
 
    """Failed applying patch!"""
 
30
class PatchFailed(BzrError):
 
31
 
 
32
    _fmt = """Patch application failed"""
32
33
 
33
34
 
34
35
class PatchInvokeError(BzrError):
35
36
 
36
 
    _fmt = """Error invoking patch: %(errstr)s\n%(stderr)s"""
 
37
    _fmt = """Error invoking patch: %(errstr)s%(stderr)s"""
37
38
    internal_error = False
38
39
 
39
 
    def __init__(self, e, stderr):
 
40
    def __init__(self, e, stderr=''):
40
41
        self.exception = e
41
42
        self.errstr = os.strerror(e.errno)
42
 
        self.stderr = stderr
 
43
        self.stderr = '\n' + stderr
43
44
 
44
45
 
45
46
class NoColor(Exception):
63
64
class ParentMissingRevisions(CommandError):
64
65
    """The parent branch is missing revisions."""
65
66
    def __init__(self, parent):
66
 
        CommandError.__init__(self, 
67
 
            "The parent branch %s is missing revisions from this branch." % 
 
67
        CommandError.__init__(self,
 
68
            "The parent branch %s is missing revisions from this branch." %
68
69
            parent)
69
70
        self.parent = parent
70
71
 
72
73
    def __init__(self):
73
74
        CommandError.__init__(self, "There is no parent, so deleting the"
74
75
                                    " branch could destroy data.")
 
76
 
 
77
class ChangedBinaryFiles(BzrError):
 
78
 
 
79
    _fmt = 'Changes involve binary files.'