X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fsrc%2FLDAPException.h;h=0db335763f4245ae712090250f6d953891f272e8;hb=d2da9c1a7d1480eb6b8ae8c2a8e78392f44f4289;hp=be4873a534da85c1248ecaa89c9a21d8b8d0a562;hpb=c0dbaa736d8cb1c86a4a730e8c9b6942e0fdbb32;p=openldap diff --git a/contrib/ldapc++/src/LDAPException.h b/contrib/ldapc++/src/LDAPException.h index be4873a534..0db335763f 100644 --- a/contrib/ldapc++/src/LDAPException.h +++ b/contrib/ldapc++/src/LDAPException.h @@ -1,5 +1,6 @@ +// $OpenLDAP$ /* - * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. + * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -9,6 +10,9 @@ #include #include +#include + +#include class LDAPAsynConnection; @@ -16,16 +20,18 @@ class LDAPAsynConnection; * This class is only thrown as an Exception and used to signalize error * conditions during LDAP-operations */ -class LDAPException{ +class LDAPException : public std::runtime_error +{ - public : + public : /** * Constructs a LDAPException-object from the parameters * @param res_code A valid LDAP result code. - * @param err_std::string An addional error message for the error + * @param err_string An addional error message for the error * that happend (optional) */ - LDAPException(int res_code, const std::string& err_string=std::string()); + LDAPException(int res_code, + const std::string& err_string=std::string()) throw(); /** * Constructs a LDAPException-object from the error state of a @@ -33,39 +39,69 @@ class LDAPException{ * @param lc A LDAP-Connection for that an error has happend. The * Constructor tries to read its error state. */ - LDAPException(const LDAPAsynConnection *lc); + LDAPException(const LDAPAsynConnection *lc) throw(); /** * Destructor */ - virtual ~LDAPException(); + virtual ~LDAPException() throw(); /** * @return The Result code of the object */ - - int getResultCode() const; + int getResultCode() const throw(); /** * @return The error message that is corresponding to the result * code . */ - const std::string& getResultMsg() const; + const std::string& getResultMsg() const throw(); /** * @return The addional error message of the error (if it was set) */ - const std::string& getServerMsg() const; + 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); + 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(); - private : - int m_res_code; - std::string m_res_string; - std::string m_err_string; + /** + * @return The List of URLs of the Referral/Search Reference + */ + const LDAPUrlList& getUrls() throw(); + + private : + LDAPUrlList m_urlList; }; + #endif //LDAP_EXCEPTION_H