Revision d1304043 kamaki/clients/quotaholder/api/exception.py

b/kamaki/clients/quotaholder/api/exception.py
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34
from kamaki.clients.commissioning import (CallError, register_exception,
35
                                       InvalidDataError, CorruptedError)
34
from kamaki.clients.commissioning import (
35
    CallError,
36
    register_exception,
37
    InvalidDataError,
38
    CorruptedError)
39

  
36 40

  
37 41
@register_exception
38 42
class CommissionException(CallError):
39 43
    pass
40 44

  
45

  
41 46
@register_exception
42 47
class InvalidKeyError(CommissionException):
43 48
    pass
44 49

  
50

  
45 51
@register_exception
46 52
class NoEntityError(CommissionException):
47 53
    pass
48 54

  
55

  
56
@register_exception
57
class CommissionValueException(CommissionException):
58
    def __init__(self, *args, **kw):
59
        super(CommissionValueException, self).__init__(*args, **kw)
60
        kwargs = self.kwargs
61

  
62
        self.source = kwargs['source']
63
        self.target = kwargs['target']
64
        self.resource = kwargs['resource']
65
        self.requested = kwargs['requested']
66
        self.current = kwargs['current']
67
        self.limit = kwargs['limit']
68

  
69

  
49 70
@register_exception
50
class NoQuantityError(CommissionException):
71
class NoQuantityError(CommissionValueException):
51 72
    pass
52 73

  
74

  
53 75
@register_exception
54
class NoCapacityError(CommissionException):
76
class NoCapacityError(CommissionValueException):
55 77
    pass
56 78

  
79

  
57 80
@register_exception
58
class ExportLimitError(CommissionException):
81
class ExportLimitError(CommissionValueException):
59 82
    pass
60 83

  
84

  
61 85
@register_exception
62
class ImportLimitError(CommissionException):
86
class ImportLimitError(CommissionValueException):
63 87
    pass
64 88

  
89

  
65 90
@register_exception
66 91
class DuplicateError(CommissionException):
67 92
    pass

Also available in: Unified diff