2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 #ifndef LDAP_EXCEPTION_H
8 #define LDAP_EXCEPTION_H
14 #include <LDAPUrlList.h>
16 class LDAPAsynConnection;
19 * This class is only thrown as an Exception and used to signalize error
20 * conditions during LDAP-operations
22 class LDAPException : public std::runtime_error
27 * Constructs a LDAPException-object from the parameters
28 * @param res_code A valid LDAP result code.
29 * @param err_string An addional error message for the error
30 * that happend (optional)
32 LDAPException(int res_code,
33 const std::string& err_string=std::string()) throw();
36 * Constructs a LDAPException-object from the error state of a
37 * LDAPAsynConnection-object
38 * @param lc A LDAP-Connection for that an error has happend. The
39 * Constructor tries to read its error state.
41 LDAPException(const LDAPAsynConnection *lc) throw();
46 virtual ~LDAPException() throw();
49 * @return The Result code of the object
51 int getResultCode() const throw();
54 * @return The error message that is corresponding to the result
57 const std::string& getResultMsg() const throw();
60 * @return The addional error message of the error (if it was set)
62 const std::string& getServerMsg() const throw();
65 virtual const char* what() const throw();
68 * This method can be used to dump the data of a LDAPResult-Object.
69 * It is only useful for debugging purposes at the moment
71 friend std::ostream& operator << (std::ostream &s, LDAPException e) throw();
75 std::string m_res_string;
76 std::string m_err_string;
80 * This class extends LDAPException and is used to signalize Referrals
81 * there were received during synchronous LDAP-operations
83 class LDAPReferralException : public LDAPException
88 * Creates an object that is initialized with a list of URLs
90 LDAPReferralException(const LDAPUrlList& urls) throw();
95 ~LDAPReferralException() throw();
98 * @return The List of URLs of the Referral/Search Reference
100 const LDAPUrlList& getUrls() throw();
103 LDAPUrlList m_urlList;
106 #endif //LDAP_EXCEPTION_H