openldap/contrib/ldapc++/src/LDAPException.h

108 lines
2.8 KiB
C
Raw Normal View History

2008-03-28 07:05:10 -04:00
// $OpenLDAP$
/*
2020-01-09 11:50:21 -05:00
* Copyright 2000-2020 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
{
2006-07-03 12:29:30 -04:00
public :
/**
* Constructs a LDAPException-object from the parameters
* @param res_code A valid LDAP result code.
ITS#8605 - spelling fixes * javascript * kernel * ldap * length * macros * maintained * manager * matching * maximum * mechanism * memory * method * mimic * minimum * modifiable * modifiers * modifying * multiple * necessary * normalized * objectclass * occurrence * occurring * offered * operation * original * overridden * parameter * permanent * preemptively * printable * protocol * provider * really * redistribution * referenced * refresh * regardless * registered * request * reserved * resource * response * sanity * separated * setconcurrency * should * specially * specifies * structure * structures * subordinates * substitution * succeed * successful * successfully * sudoers * sufficient * superiors * supported * synchronization * terminated * they're * through * traffic * transparent * unsigned * unsupported * version * absence * achieves * adamson * additional * address * against * appropriate * architecture * associated * async * attribute * authentication * authorized * auxiliary * available * begin * beginning * buffered * canonical * certificate * charray * check * class * compatibility * compilation * component * configurable * configuration * configure * conjunction * constraints * constructor * contained * containing * continued * control * convenience * correspond * credentials * cyrillic * database * definitions * deloldrdn * dereferencing * destroy * distinguish * documentation * emmanuel * enabled * entry * enumerated * everything * exhaustive * existence * existing * explicitly * extract * fallthru * fashion * february * finally * function * generically * groupname * happened * implementation * including * initialization * initializes * insensitive * instantiated * instantiation * integral * internal * iterate
2017-02-26 02:49:31 -05:00
* @param err_string An additional error message for the error
* that happened (optional)
*/
2006-07-03 12:29:30 -04:00
LDAPException(int res_code,
const std::string& err_string=std::string()) throw();
/**
* Constructs a LDAPException-object from the error state of a
* LDAPAsynConnection-object
ITS#8605 - spelling fixes * javascript * kernel * ldap * length * macros * maintained * manager * matching * maximum * mechanism * memory * method * mimic * minimum * modifiable * modifiers * modifying * multiple * necessary * normalized * objectclass * occurrence * occurring * offered * operation * original * overridden * parameter * permanent * preemptively * printable * protocol * provider * really * redistribution * referenced * refresh * regardless * registered * request * reserved * resource * response * sanity * separated * setconcurrency * should * specially * specifies * structure * structures * subordinates * substitution * succeed * successful * successfully * sudoers * sufficient * superiors * supported * synchronization * terminated * they're * through * traffic * transparent * unsigned * unsupported * version * absence * achieves * adamson * additional * address * against * appropriate * architecture * associated * async * attribute * authentication * authorized * auxiliary * available * begin * beginning * buffered * canonical * certificate * charray * check * class * compatibility * compilation * component * configurable * configuration * configure * conjunction * constraints * constructor * contained * containing * continued * control * convenience * correspond * credentials * cyrillic * database * definitions * deloldrdn * dereferencing * destroy * distinguish * documentation * emmanuel * enabled * entry * enumerated * everything * exhaustive * existence * existing * explicitly * extract * fallthru * fashion * february * finally * function * generically * groupname * happened * implementation * including * initialization * initializes * insensitive * instantiated * instantiation * integral * internal * iterate
2017-02-26 02:49:31 -05:00
* @param lc A LDAP-Connection for that an error has happened. 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();
/**
ITS#8605 - spelling fixes * javascript * kernel * ldap * length * macros * maintained * manager * matching * maximum * mechanism * memory * method * mimic * minimum * modifiable * modifiers * modifying * multiple * necessary * normalized * objectclass * occurrence * occurring * offered * operation * original * overridden * parameter * permanent * preemptively * printable * protocol * provider * really * redistribution * referenced * refresh * regardless * registered * request * reserved * resource * response * sanity * separated * setconcurrency * should * specially * specifies * structure * structures * subordinates * substitution * succeed * successful * successfully * sudoers * sufficient * superiors * supported * synchronization * terminated * they're * through * traffic * transparent * unsigned * unsupported * version * absence * achieves * adamson * additional * address * against * appropriate * architecture * associated * async * attribute * authentication * authorized * auxiliary * available * begin * beginning * buffered * canonical * certificate * charray * check * class * compatibility * compilation * component * configurable * configuration * configure * conjunction * constraints * constructor * contained * containing * continued * control * convenience * correspond * credentials * cyrillic * database * definitions * deloldrdn * dereferencing * destroy * distinguish * documentation * emmanuel * enabled * entry * enumerated * everything * exhaustive * existence * existing * explicitly * extract * fallthru * fashion * february * finally * function * generically * groupname * happened * implementation * including * initialization * initializes * insensitive * instantiated * instantiation * integral * internal * iterate
2017-02-26 02:49:31 -05:00
* @return The additional 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();
2006-07-03 12:29:30 -04:00
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