~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to errors.py

  • Committer: Aaron Bentley
  • Date: 2006-12-04 14:32:43 UTC
  • Revision ID: abentley@panoramicfeedback.com-20061204143243-i28ph41mdgbsofev
Fixed handling of pipe errors when writing to patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    along with this program; if not, write to the Free Software
16
16
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
 
18
import os
 
19
 
18
20
class NoPyBaz(Exception):
19
21
    def __init__(self):
20
22
        Exception.__init__(self, "PyBaz is not installed.")
21
23
try:
22
24
    from bzrlib.errors import BzrCommandError as CommandError
 
25
    from bzrlib.errors import BzrError
23
26
except ImportError:
24
27
    class CommandError(Exception):
25
28
        pass
28
31
    """Failed applying patch!"""
29
32
 
30
33
 
 
34
class PatchInvokeError(BzrError):
 
35
 
 
36
    _fmt = """Error invoking patch: %(errstr)s\n%(stderr)s"""
 
37
    internal_error = False
 
38
 
 
39
    def __init__(self, e, stderr):
 
40
        self.exception = e
 
41
        self.errstr = os.strerror(e.errno)
 
42
        self.stderr = stderr
 
43
 
 
44
 
31
45
class NoColor(Exception):
32
46
    """Color not available on this terminal."""
33
47