-
Notifications
You must be signed in to change notification settings - Fork 0
/
exceptions.h
74 lines (65 loc) · 1.68 KB
/
exceptions.h
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
#include <exception>
#include <string>
namespace Ldap {
enum class ErrorCode: int {
success = 0,
operationsError = 1,
protocolError = 2,
timeLimitExceeded = 3,
sizeLimitExceeded = 4,
compareFalse = 5,
compareTrue = 6,
authMethodNotSupported = 7,
strongerAuthRequired = 8,
referral = 10,
adminLimitExceeded = 11,
unavailableCriticalExtension = 12,
confidentialityRequired = 13,
saslBindInProgress = 14,
noSuchAttribute = 16,
undefinedAttributeType = 17,
inappropriateMatching = 18,
constraintViolation = 19,
attributeOrValueExists = 20,
invalidAttributeSyntax = 21,
noSuchObject = 32,
aliasProblem = 33,
invalidDNSyntax = 34,
aliasDereferencingProblem = 36,
inappropriateAuthentication = 48,
invalidCredentials = 49,
insufficientAccessRights = 50,
busy = 51,
unavailable = 52,
unwillingToPerform = 53,
loopDetect = 54,
namingViolation = 64,
objectClassViolation = 65,
notAllowedOnNonLeaf = 66,
notAllowedOnRDN = 67,
entryAlreadyExists = 68,
objectClassModsProhibited = 69,
affectsMultipleDSAs = 71,
other = 80
};
class Exception: public std::exception
{
public:
Exception(ErrorCode code);
Exception(ErrorCode code, const char* what);
virtual const char* what() const throw() {
return _what.c_str();
};
operator int() const {
return static_cast<int>(_code);
};
operator ErrorCode() const {
return _code;
}
private:
ErrorCode _code;
const std::string _what;
};
// Use this instead of asserting when decoding and parsing protocol data
void checkProtocolError(bool exprResult);
} // namespace Ldap