本文整理汇总了C++中Exception::Message方法的典型用法代码示例。如果您正苦于以下问题:C++ Exception::Message方法的具体用法?C++ Exception::Message怎么用?C++ Exception::Message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::Message方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareExceptionData
ILog::LoggingData ILog::PrepareExceptionData(const Exception<false> &e)
{
LoggingData ret;
ret.MessageLevel = LogLevelError;
ret.Message = e.Message();
ret.Title = String::Format("%s caught", e.what());
return ret;
}
示例2: Error
//Generate an error result set from an exception.
//Per LSCP spec, error result is a sinle line in the following format:
//ERR:<CODE>:Message text\r\n
//This method will be used to generate unknown errors only (code 0)
//To generate errors with other codes as well as warnings use other methods (below).
//Because this is an unknown error, this method will also print message to the stderr.
void LSCPResultSet::Error(Exception e) {
e.PrintMessage();
Error(e.Message());
}
示例3: UnhandledExceptionHandler
void OpenHome::UnhandledExceptionHandler(Exception& aException)
{
Bws<5> thName;
GetThreadName(thName);
char buf[1024];
(void)snprintf(buf, sizeof(buf), "Unhandled exception %s at %s:%lu in thread %s\n", aException.Message(), aException.File(), (unsigned long)aException.Line(), thName.Ptr());
TInt len = 8*1024;
char* msg = new char[len];
if (msg != NULL) {
(void)strncpy(msg, buf, len);
len -= (TInt)strlen(buf);
(void)strncat(msg, "\n", len);
len -= 2;
THandle stackTrace = aException.StackTrace();
TUint count = Os::StackTraceNumEntries(stackTrace);
for (TUint i=0; i<count; i++) {
const char* entry = Os::StackTraceEntry(stackTrace, i);
(void)strncat(msg, entry, len);
len -= (TInt)strlen(entry) + 2;
if (len < 0) {
break;
}
(void)strncat(msg, "\n", len);
}
}
if (len > 0) {
(void)strncat(msg, "\n", len);
}
CallFatalErrorHandler((msg!=NULL? msg : buf));
delete msg;
}