C++ REST SDK 遇到“_REPORT_PPLTASK_UNOBSERVED_EXCEPTION”未处理异常

weixin_38061608 2017-05-16 04:00:03
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();
}
}
请问如何处理这种异常?谢谢。



我是快乐的小鱼^_^
...全文
13 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复

476

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧