/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to errors.py

Add more tests for fetch code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""A grouping of Exceptions for bzr-git"""
18
18
 
19
19
from bzrlib import errors as bzr_errors
 
20
from dulwich import errors as git_errors
20
21
 
21
22
 
22
23
class BzrGitError(bzr_errors.BzrError):
32
33
        self.command = command
33
34
        self.returncode = returncode
34
35
        self.stderr = stderr
 
36
 
 
37
 
 
38
class NoSuchRef(BzrGitError):
 
39
    """Raised when a ref can not be found.""" 
 
40
 
 
41
    _fmt = "The ref %(ref)s was not found."
 
42
    
 
43
    def __init__(self, ref):
 
44
        self.ref = ref
 
45
 
 
46
class LightWeightCheckoutsNotSupported(BzrGitError):
 
47
    _fmt = "bzr-git does not support creating lightweight checkouts at the moment."
 
48
 
 
49
 
 
50
def convert_dulwich_error(error):
 
51
    """Convert a Dulwich error to a Bazaar error."""
 
52
 
 
53
    if isinstance(error, git_errors.HangupException):
 
54
        raise bzr_errors.ConnectionReset(error.msg, "")
 
55
    raise error