src/lemon/error.h
changeset 1209 dc9fdf77007f
parent 1207 8117169c9049
child 1213 6cc106135d31
equal deleted inserted replaced
6:902c2e406ae2 7:6a75c0bc79e6
   417     ///\e
   417     ///\e
   418     int get_line() const { return line; }
   418     int get_line() const { return line; }
   419 
   419 
   420 
   420 
   421     virtual const char* what() const throw() {
   421     virtual const char* what() const throw() {
   422       const char *mes = 0;
       
   423       try {
   422       try {
   424 	std::ostringstream ostr;
   423 	std::ostringstream ostr;
   425 	ostr << file << ":" << line << ": ";
   424 	ostr << file << ":" << line << ": ";
   426 	if( function )
   425 	if( function )
   427 	  ostr << function << ": ";
   426 	  ostr << function << ": ";
   428 	ostr << message;
   427 	ostr << message;
   429 	if( assertion )
   428 	if( assertion )
   430 	  ostr << " (assertion '" << assertion << "' failed)";
   429 	  ostr << " (assertion '" << assertion << "' failed)";
   431 	mes = ostr.str().c_str();
   430 	return ostr.str().c_str();
   432 	/// \bug Szerintem a 'mes'-re nem szabad hivatkozni, mert
       
   433 	/// az elobb felszabadul. 
       
   434       }
   431       }
   435       catch(...) {}
   432       catch(...) {}
   436       if( mes ) return mes;
       
   437       return exceptionName();
   433       return exceptionName();
   438     }
   434     }
   439 
   435 
   440     virtual const char* exceptionName() const {
   436     virtual const char* exceptionName() const {
   441       return "lemon::AssertionFailedError";
   437       return "lemon::AssertionFailedError";