C++ REST SDK 遇到“_REPORT_PPLTASK_UNOBSERVED_EXCEPTION”未处理异常
wstring strClient = L"http://test123.com/wrong.api";
http_client client(strClient);
try
{
client.request(methods::GET).then([&](http_response response)
{
//省略
}
}
catch (const std::system_error& e)
{
CString strLog;
strLog.Format(L"用户名密码登录时错误:%s", e.what());
return false;
}
catch (const std::exception& e)
{
CString strLog;
strLog.Format(L"用户名密码登录时错误:%s", e.what());
return false;
}catch(...){//...}
如上演示代码,故意输错一个不存在的WebAPI地址,调试时会出现未处理异常,并跳转到这里。
~_ExceptionHolder()
{
if (_M_exceptionObserved == 0)
{
// If you are trapped here, it means an exception thrown in task chain didn't get handled.
// Please add task-based continuation to handle all exceptions coming from tasks.
// this->_M_stackTrace keeps the creation callstack of the task generates this exception.
_REPORT_PPLTASK_UNOBSERVED_EXCEPTION();
}
}
请问如何处理这种异常?谢谢。
我是快乐的小鱼^_^