File size: 756 Bytes
246d201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class PatchingException(Exception):
    pass


class HunkException(PatchingException):
    def __init__(self, msg, hunk=None):
        self.hunk = hunk
        if hunk is not None:
            super(HunkException, self).__init__(
                '{msg}, in hunk #{n}'.format(msg=msg, n=hunk)
            )
        else:
            super(HunkException, self).__init__(msg)


class ApplyException(PatchingException):
    pass


class SubprocessException(ApplyException):
    def __init__(self, msg, code):
        super(SubprocessException, self).__init__(msg)
        self.code = code


class HunkApplyException(HunkException, ApplyException, ValueError):
    pass


class ParseException(HunkException, ValueError):
    pass