namespace exception {
using namespace std ;
pthread_mutex_t METHOD_MUTEX ; // This mutex is used in order to lock the file for writing log infornation
+
/* *********************************
* Exception Class Implementation
************************************/
//Constructor/Destructor
-
Exception::Exception () {
line = 0;
-} ;
+};
Exception::~Exception() throw(){ }
line = line_number;
method_name = method;
error_message = "";
- exception_name = "";
}
Exception::Exception( const std::string& file, int line_number, const std::string& method, int code, const std::string& name)
const char* Exception::what() const throw(){
if (!ancestor.empty()) return ancestor.c_str();
-
- return error_message.c_str();
+ return error_message.c_str();
};
string Exception::getExceptionName(){
string Exception::dbgMessage(){
string result ;
- //Adding exception Name
- result = exception_name;
-
+ result = "";
+ // Exception name should be displayed only once
+ if (stack_strings.size()==0){result +=exception_name;};
//Adding error msg
if (error_message!="") result +=": " + string(what());
-
if (result != "") result+="\n";
-
//Adding Source
result +="\tat " + method_name +"[" +source_file;
-
//Adding line number
if (line!=0){
char buffer [1024] ;