locked
How do I force a promise to be rejected in a .then() function?

    Question

  • After making a call to a web API via WinJS.xhr (with a post), the response goes to the onComplete function provided in .then(). There I need to parse the response and determine whether or not a user was successfully logged in, and if so I need to store their user hash in app storage. This would be two Promise objects: First the one returned by WinJS.xhr and then possibly the one returned by Windows.ApplicationModel.roaming.writeText. What I can't figure out is how to combine these two in a way that allows me to return one promise object.

    Thursday, May 24, 2012 11:43 PM

Answers

  • I figured out using throw does what I need and allows the chaining I'm looking for.



    • Edited by Ted.D Wednesday, May 30, 2012 5:24 PM
    • Marked as answer by Ted.D Wednesday, May 30, 2012 5:24 PM
    Wednesday, May 30, 2012 4:18 PM

All replies