2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
10 #include "LDAPException.h"
11 #include "LDAPReferralException.h"
13 #include "LDAPAsynConnection.h"
17 LDAPException::LDAPException(int res_code, const string& err_string){
19 m_res_string=string(ldap_err2string(res_code));
20 m_err_string=err_string;
23 LDAPException::LDAPException(const LDAPAsynConnection *lc){
24 m_err_string=string();
25 m_res_string=string();
26 LDAP *l = lc->getSessionHandle();
27 ldap_get_option(l,LDAP_OPT_ERROR_NUMBER,&m_res_code);
28 m_res_string=string(ldap_err2string(m_res_code));
30 ldap_get_option(l,LDAP_OPT_ERROR_STRING,&err_string);
31 m_err_string=string(err_string);
34 LDAPException::~LDAPException(){
37 int LDAPException::getResultCode() const{
41 const string& LDAPException::getResultMsg() const{
45 const string& LDAPException::getServerMsg() const{
49 ostream& operator << (ostream& s, LDAPException e){
50 s << "Error " << e.m_res_code << ": " << e.m_res_string;
51 if (!e.m_err_string.empty()) {
52 s << endl << "additional info: " << e.m_err_string ;