locked
custom data source sample RRS feed

  • Question

  • Hello guys.

    I'm looking at the code for building a custom data source which can be found here: http://msdn.microsoft.com/en-us/library/windows/apps/hh770849.aspx

    Stupid question: why does the getCount method returns a Promise (which wraps an error) from the error xhr function while the itemsFromIndex returns a "simple" error value? Shouldn't both of them return a promise? or isn't that really important?

    thanks.


    Luis Abreu

    Sunday, April 1, 2012 2:29 PM

Answers

  • According to the code, itemsFromIndex does in fact return a Promise containing the error:

    itemsFromIndex: function (requestIndex, countBefore, countAfter) {
                    var that = this;
                    if (requestIndex >= that._maxCount) {
                        return Promise.wrapError(new WinJS.ErrorFromName(UI.FetchError.doesNotExist));
                    }

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Monday, April 16, 2012 4:06 PM
    Moderator

All replies

  • Hi Luis - I'll look into this when I get a few minutes.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Thursday, April 5, 2012 2:08 PM
    Moderator
  • Thanks Matt.

    Luis Abreu

    Thursday, April 5, 2012 2:42 PM
  • According to the code, itemsFromIndex does in fact return a Promise containing the error:

    itemsFromIndex: function (requestIndex, countBefore, countAfter) {
                    var that = this;
                    if (requestIndex >= that._maxCount) {
                        return Promise.wrapError(new WinJS.ErrorFromName(UI.FetchError.doesNotExist));
                    }

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Monday, April 16, 2012 4:06 PM
    Moderator
  • Hello Matt.

    Thanks for confirming this. I'm almost positive that when I was digging into that code a few days ago, it wasn't wrapped...

    thanks again.


    Luis Abreu

    Monday, April 16, 2012 8:41 PM