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 catch exceptions which occur inside asynchronous methods? (Windows Store app, PPL)

$
0
0
Thank you, guys! Now it works.
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);

    task <UserIdentity ^> authenticationTask (auth->AuthenticateUserAsync (request_vec, CredentialPromptType::RetypeCredentials));
    
    authenticationTask.then ([] (task <UserIdentity ^> idtask)
    { 
        try 
        { 
            auto ident = idtask.get ();

            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)
        {
            std::wstring s = std::wstring (ex->Message->Data ());

            int _break_point_here = 0;
        }
    });
I am very appreciated for your help!

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>