Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: How to end up a thread while encounter a task exception in a ".then" contuation task

$
0
0
Well, the following codes are capsulated in a thread. Is there any way to quit the thread when catch an exception in the "catch" sub block?
      .then([&](http_response resp)        
      {
            try
    {
        resp_json = resp.get();
    }
    catch (const std::exception& e)
    {
        excep_str = L"Caught exception: ";
        excep_str.AppendFormat(_T("%s"), e.what());
        MessageBox(excep_str);
        return;                          //this will just return to the thread function and go on
    }       
       }
       // the left codes in thread function
       ......      

Viewing all articles
Browse latest Browse all 4845

Trending Articles