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"
15 LDAPException::LDAPException(int res_code, const string& err_string){
17 m_res_string=string(ldap_err2string(res_code));
18 m_err_string=err_string;
21 LDAPException::LDAPException(const LDAPAsynConnection *lc){
22 m_err_string=string();
23 m_res_string=string();
24 LDAP *l = lc->getSessionHandle();
25 ldap_get_option(l,LDAP_OPT_ERROR_NUMBER,&m_res_code);
26 m_res_string=string(ldap_err2string(m_res_code));
28 ldap_get_option(l,LDAP_OPT_ERROR_STRING,&err_string);
29 m_err_string=string(err_string);
32 LDAPException::~LDAPException(){
35 int LDAPException::getResultCode() const{
39 const string& LDAPException::getResultMsg() const{
43 const string& LDAPException::getServerMsg() const{
47 ostream& operator << (ostream& s, LDAPException e){
48 s << "Error " << e.m_res_code << ": " << e.m_res_string;
49 if (e.m_err_string.size() > 0) {
50 s << endl << "additional info: " << e.m_err_string ;