blob: c81093235a6feb5eea29a6a7271d091fe16e65bf (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// $OpenLDAP$
/*
* Copyright 2000-2018 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDAP_EXCEPTION_H
#define LDAP_EXCEPTION_H
#include <iostream>
#include <string>
#include <stdexcept>
#include <LDAPUrlList.h>
class LDAPAsynConnection;
/**
* This class is only thrown as an Exception and used to signalize error
* conditions during LDAP-operations
*/
class LDAPException : public std::runtime_error
{
public :
/**
* Constructs a LDAPException-object from the parameters
* @param res_code A valid LDAP result code.
* @param err_string An addional error message for the error
* that happend (optional)
*/
LDAPException(int res_code,
const std::string& err_string=std::string()) throw();
/**
* Constructs a LDAPException-object from the error state of a
* LDAPAsynConnection-object
* @param lc A LDAP-Connection for that an error has happend. The
* Constructor tries to read its error state.
*/
LDAPException(const LDAPAsynConnection *lc) throw();
/**
* Destructor
*/
virtual ~LDAPException() throw();
/**
* @return The Result code of the object
*/
int getResultCode() const throw();
/**
* @return The error message that is corresponding to the result
* code .
*/
const std::string& getResultMsg() const throw();
/**
* @return The addional error message of the error (if it was set)
*/
const std::string& getServerMsg() const throw();
virtual const char* what() const throw();
/**
* This method can be used to dump the data of a LDAPResult-Object.
* It is only useful for debugging purposes at the moment
*/
friend std::ostream& operator << (std::ostream &s, LDAPException e) throw();
private :
int m_res_code;
std::string m_res_string;
std::string m_err_string;
};
/**
* This class extends LDAPException and is used to signalize Referrals
* there were received during synchronous LDAP-operations
*/
class LDAPReferralException : public LDAPException
{
public :
/**
* Creates an object that is initialized with a list of URLs
*/
LDAPReferralException(const LDAPUrlList& urls) throw();
/**
* Destructor
*/
~LDAPReferralException() throw();
/**
* @return The List of URLs of the Referral/Search Reference
*/
const LDAPUrlList& getUrls() throw();
private :
LDAPUrlList m_urlList;
};
#endif //LDAP_EXCEPTION_H
|