本文整理汇总了C++中Exception::get_errorMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ Exception::get_errorMsg方法的具体用法?C++ Exception::get_errorMsg怎么用?C++ Exception::get_errorMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::get_errorMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: error_logger
///////////////////////////////////////////////////////////////////////////////
/// @fn void error_logger( const Exception& e )
/// @brief Writes e to a file and also to the screen.
/// @pre e exists.
/// @param const Exception& e - The Exception to write to file and screen.
/// @post Writes e to a file and also to the screen.
/// @return None.
///////////////////////////////////////////////////////////////////////////////
void error_logger( const Exception& e )
{
// Store the error message for output to file and screen.
string msg = "Exception: " + e.get_errorMsg();
// Show the message to the screen.
cout << msg << endl;
return;
}
示例2: error_logger
///////////////////////////////////////////////////////////////////////////////
/// @fn void error_logger( const Exception& e )
/// @brief Writes e to a file and also to the screen.
/// @pre e exists.
/// @param const Exception& e - The Exception to write to file and screen.
/// @post Writes e to a file and also to the screen.
/// @return None.
///////////////////////////////////////////////////////////////////////////////
void error_logger( const Exception& e )
{
//Create/open the log file.
File elog( "errorlog.txt" );
//Store the error message for output to file and screen.
string msg = "Exception " + int_to_str( e.get_errorCode() ) + ": " + e.get_errorMsg();
//Insert the error at the end of the file.
elog.insert_line( elog.get_num_lines(), msg );
//Save the file, then close it.
elog.close(true);
//Show the message to the screen.
cout << msg << endl;
return;
}