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
Post a Comment