summaryrefslogtreecommitdiffstats
path: root/aurweb/exceptions.py
blob: 62015284e8a727fb235c82cabfc28b20ff80e1be (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
class AurwebException(Exception):
    pass


class MaintenanceException(AurwebException):
    pass


class BannedException(AurwebException):
    pass


class PermissionDeniedException(AurwebException):
    def __init__(self, user):
        msg = 'permission denied: {:s}'.format(user)
        super(PermissionDeniedException, self).__init__(msg)


class BrokenUpdateHookException(AurwebException):
    def __init__(self, cmd):
        msg = 'broken update hook: {:s}'.format(cmd)
        super(BrokenUpdateHookException, self).__init__(msg)


class InvalidUserException(AurwebException):
    def __init__(self, user):
        msg = 'unknown user: {:s}'.format(user)
        super(InvalidUserException, self).__init__(msg)


class InvalidPackageBaseException(AurwebException):
    def __init__(self, pkgbase):
        msg = 'package base not found: {:s}'.format(pkgbase)
        super(InvalidPackageBaseException, self).__init__(msg)


class InvalidRepositoryNameException(AurwebException):
    def __init__(self, pkgbase):
        msg = 'invalid repository name: {:s}'.format(pkgbase)
        super(InvalidRepositoryNameException, self).__init__(msg)


class PackageBaseExistsException(AurwebException):
    def __init__(self, pkgbase):
        msg = 'package base already exists: {:s}'.format(pkgbase)
        super(PackageBaseExistsException, self).__init__(msg)


class InvalidReasonException(AurwebException):
    def __init__(self, reason):
        msg = 'invalid reason: {:s}'.format(reason)
        super(InvalidReasonException, self).__init__(msg)


class InvalidCommentException(AurwebException):
    def __init__(self, comment):
        msg = 'comment is too short: {:s}'.format(comment)
        super(InvalidCommentException, self).__init__(msg)


class AlreadyVotedException(AurwebException):
    def __init__(self, comment):
        msg = 'already voted for package base: {:s}'.format(comment)
        super(AlreadyVotedException, self).__init__(msg)


class NotVotedException(AurwebException):
    def __init__(self, comment):
        msg = 'missing vote for package base: {:s}'.format(comment)
        super(NotVotedException, self).__init__(msg)


class InvalidArgumentsException(AurwebException):
    def __init__(self, msg):
        super(InvalidArgumentsException, self).__init__(msg)