c++11 - How to catch exceptions which occur inside asynchronous methods? (Windows Store app, PPL) -


i trying catch exception onlineidauthenticator::authenticateuserasync method, occurs when there no internet connection example.

i've found some info topic, didn't me.

here code demonstrates way tried process errors:

auto auth = ref new onlineidauthenticator (); auto request = ref new onlineidserviceticketrequest ("wl.signin wl.basic wl.skydrive_update", "delegation"); auto request_vec = ref new vector <onlineidserviceticketrequest ^> (); request_vec->append (request);  create_task (auth->authenticateuserasync (request_vec, credentialprompttype::retypecredentials)) .then ([] (useridentity ^ident) {     try     {         auto ticket = ident->tickets->getat (0);         token = std::wstring (ticket->value->data ());     }     catch (const concurrency::task_canceled &)     {         int _break_point_here = 0;     }     catch (const std::exception &)     {         int _break_point_here = 0;     }     catch (platform::exception ^ex)     {         int _break_point_here = 0;     } }); 

but no 1 these catches doesn't work when authenticateuserasync method fails. help, please. right way catch exceptions asynchronous method?

i've got answer here. question closed.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -