ldapsdk 0.0.1
|
00001 // $OpenLDAP$ 00002 /* 00003 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. 00004 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 00005 */ 00006 00007 00008 #ifndef LDAP_EXCEPTION_H 00009 #define LDAP_EXCEPTION_H 00010 00011 #include <iostream> 00012 #include <string> 00013 #include <stdexcept> 00014 00015 #include <LDAPUrlList.h> 00016 00017 class LDAPAsynConnection; 00018 00023 class LDAPException : public std::runtime_error 00024 { 00025 00026 public : 00033 LDAPException(int res_code, 00034 const std::string& err_string=std::string()) throw(); 00035 00042 LDAPException(const LDAPAsynConnection *lc) throw(); 00043 00047 virtual ~LDAPException() throw(); 00048 00052 int getResultCode() const throw(); 00053 00058 const std::string& getResultMsg() const throw(); 00059 00063 const std::string& getServerMsg() const throw(); 00064 00065 00066 virtual const char* what() const throw(); 00067 00072 friend std::ostream& operator << (std::ostream &s, LDAPException e) throw(); 00073 00074 private : 00075 int m_res_code; 00076 std::string m_res_string; 00077 std::string m_err_string; 00078 }; 00079 00084 class LDAPReferralException : public LDAPException 00085 { 00086 00087 public : 00091 LDAPReferralException(const LDAPUrlList& urls) throw(); 00092 00096 ~LDAPReferralException() throw(); 00097 00101 const LDAPUrlList& getUrls() throw(); 00102 00103 private : 00104 LDAPUrlList m_urlList; 00105 }; 00106 00107 #endif //LDAP_EXCEPTION_H