#include "stdafx.h" #include "AdoException.h" using namespace AdoLib; CAdoException::CAdoException() : m_warnCode(0) { } CAdoException::CAdoException(std::string message, int errorCode, std::string description) : m_warnCode(errorCode), m_message(message), m_description(description) { } CAdoException::CAdoException(std::string message, int errorCode, std::string description, std::string source, std::string location) : m_warnCode(errorCode), m_message(message), m_description(description), m_source(source), m_Location(location) { } CAdoException::~CAdoException() { } int CAdoException::getErrorCode() { return m_warnCode; } std::string CAdoException::getMessage() { return m_message; } std::string CAdoException::getDescription() { return m_description; } std::string CAdoException::getSource() { return m_source; } std::string CAdoException::getLocation() { return m_Location; } std::string CAdoException::toString() { char szErrorCode[16]; sprintf_s(szErrorCode, "%d", getErrorCode()); std::string buffer; buffer.append("\t[CAdoException]\r\n"); buffer.append("\t[code]" ); buffer.append(szErrorCode );buffer.append("\r\n"); buffer.append("\t[message]" ); buffer.append(getMessage() );buffer.append("\r\n"); buffer.append("\t[description]" ); buffer.append(getDescription() );buffer.append("\r\n"); buffer.append("\t[souce]" ); buffer.append(getSource() );buffer.append("\r\n"); buffer.append("\t[location]" ); buffer.append(getLocation() );buffer.append("\r\n"); return buffer; }