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
13 class LDAPAsynConnection;
16 * This class is only thrown as an Exception and used to signalize error
17 * conditions during LDAP-operations
23 * Constructs a LDAPException-object from the parameters
24 * @param res_code A valid LDAP result code.
25 * @param err_string An addional error message for the error
26 * that happend (optional)
28 LDAPException(int res_code, const std::string& err_string=std::string());
31 * Constructs a LDAPException-object from the error state of a
32 * LDAPAsynConnection-object
33 * @param lc A LDAP-Connection for that an error has happend. The
34 * Constructor tries to read its error state.
36 LDAPException(const LDAPAsynConnection *lc);
41 virtual ~LDAPException();
44 * @return The Result code of the object
47 int getResultCode() const;
50 * @return The error message that is corresponding to the result
53 const std::string& getResultMsg() const;
56 * @return The addional error message of the error (if it was set)
58 const std::string& getServerMsg() const;
61 * This method can be used to dump the data of a LDAPResult-Object.
62 * It is only useful for debugging purposes at the moment
64 friend std::ostream& operator << (std::ostream &s, LDAPException e);
68 std::string m_res_string;
69 std::string m_err_string;
71 #endif //LDAP_EXCEPTION_H