-
Notifications
You must be signed in to change notification settings - Fork 0
/
selexorexceptions.py
79 lines (56 loc) · 1.84 KB
/
selexorexceptions.py
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
76
77
78
79
"""
<Module Name>
selexorexceptions.py
<Started>
August 8, 2012
<Author>
Leonard Law
<Purpose>
Defines all exceptions that are raised by SeleXor components.
"""
class SelexorException(Exception):
""" Base class for all Selexor exceptions. """
class SelexorInvalidOperation(SelexorException):
""" Attempted to perform an operation that is not supported. """
class SelexorAuthenticationFailed(SelexorException):
""" An authentication attempt failed. """
def __init__(self, errstring = ""):
self.errstring = str(errstring)
def __str__(self):
return "Authentication failed: " + errstring
class SelexorInvalidRequest(SelexorException):
""" An invalid request was passed in. """
class SelexorInternalError(SelexorException):
""" An internal error in SeleXor occurred. """
class RuleException(Exception):
''' Base exception describing an invalid rule action. '''
class UnknownRule(RuleException):
'''
An unknown rule was specified.
To see a list of known rules, use the list_all_rules() function.
'''
class UnknownRuleType(RuleException):
'''
Attempted to register a rule to an unknown rule type.
See _RULE_TYPES for a list of valid rules.
'''
class MissingParameter(RuleException):
''' '''
def __init__(self, paramname = ""):
self.paramname = str(paramname)
def __str__(self):
return "Missing Parameter: " + paramname
class BadParameter(RuleException):
''' The parameter passed in is not what was expected. '''
class InvalidRuleReregistration(RuleException):
'''
Attempted to register a rule callback to a rule that was already defined.
Unregister a rule before replacing it.
'''
class UnknownLocation(Exception):
""" Unknown location """
def __init__(self, location = ""):
self.location = location
def __str__(self):
return "Unknown location: " + self.location