locked
Window.OnError - Base.js - Line 1775 [object XMLHttpRequest] RRS feed

  • Question

  • This is all the information I could capture about a recent user crash: "Window.OnError - Base.js - Line 1775 [object XMLHttpRequest]"

    var ErrorPromise = WinJS.Class.define(
            function ErrorPromise_ctor(value) {
    
                if (tagWithStack && (tagWithStack === true || (tagWithStack & tag.errorPromise))) {
                    this._stack = WinJS.Promise._getStack();
                }
    
                this._value = value;
                callonerror(this, value, detailsForError);
            }, {
                cancel: function () {
                    /// <signature helpKeyword="WinJS.PromiseStateMachine.cancel">
                    /// <summary locid="WinJS.PromiseStateMachine.cancel">
                    /// Attempts to cancel the fulfillment of a promised value. If the promise hasn't
                    /// already been fulfilled and cancellation is supported, the promise enters
                    /// the error state with a value of Error("Canceled").
                    /// </summary>
                    /// </signature>
                },
                done: function ErrorPromise_done(unused, onError) {
                    /// <signature helpKeyword="WinJS.PromiseStateMachine.done">
                    /// <summary locid="WinJS.PromiseStateMachine.done">
                    /// Allows you to specify the work to be done on the fulfillment of the promised value,
                    /// the error handling to be performed if the promise fails to fulfill
                    /// a value, and the handling of progress notifications along the way.
                    /// 
                    /// After the handlers have finished executing, this function throws any error that would have been returned
                    /// from then() as a promise in the error state.
                    /// </summary>
                    /// <param name="onComplete" type="Function" locid="WinJS.PromiseStateMachine.done_p:onComplete">
                    /// The function to be called if the promise is fulfilled successfully with a value.
                    /// The fulfilled value is passed as the single argument. If the value is null,
                    /// the fulfilled value is returned. The value returned
                    /// from the function becomes the fulfilled value of the promise returned by
                    /// then(). If an exception is thrown while executing the function, the promise returned
                    /// by then() moves into the error state.
                    /// </param>
                    /// <param name="onError" type="Function" optional="true" locid="WinJS.PromiseStateMachine.done_p:onError">
                    /// The function to be called if the promise is fulfilled with an error. The error
                    /// is passed as the single argument. If it is null, the error is forwarded.
                    /// The value returned from the function is the fulfilled value of the promise returned by then().
                    /// </param>
                    /// <param name="onProgress" type="Function" optional="true" locid="WinJS.PromiseStateMachine.done_p:onProgress">
                    /// the function to be called if the promise reports progress. Data about the progress
                    /// is passed as the single argument. Promises are not required to support
                    /// progress.
                    /// </param>
                    /// </signature>
                    var value = this._value;
                    if (onError) {
                        try {
                            if (!onError.handlesOnError) {
                                callonerror(null, value, detailsForHandledError, this, onError);
                            }
                            var result = onError(value);
                            if (result && typeof result === "object" && typeof result.done === "function") {
                                // If a promise is returned we need to wait on it.
                                result.done();
                            }
                            return;
                        } catch (ex) {
                            value = ex;
                        }
                    }
                    if (value instanceof Error && value.message === canceledName) {
                        // suppress cancel
                        return;
                    }
                    // force the exception to be thrown asyncronously to avoid any try/catch blocks
                    //
                    WinJS.Utilities.Scheduler.schedule(function () {
                        throw value;
                    }, WinJS.Utilities.Scheduler.Priority.normal, null, "WinJS.Promise._throwException");
                },

    It is pointing me to the lines after: "// force the exception to be thrown asyncronously to avoid any try/catch blocks" (including the spelling mistake)

    All of my WinJS.Promises have error handling (at the bottom of the promise), but this is breaking out of that chain?

    I am not sure how to proceed here or where I should be looking for the bug that caused this. Would this be caused by a bug within a promises error handling, or is it likely within the promise itself?

    Is there any way I can log more information about this crash, something I can add to my promise chain? Any way I can break out the data from the [object XMLHttpRequest]?

    The code that captured the error is simply:

    window.onerror = function (msg, url, linenumber) {}
    Can I check for "XMLHttpRequest" in 'msg' and then somehow breakout that object to information that is more helpful? Would converting it from an object to a string work, or is there a better way to do this?

    Thanks for reading my question.

    Sunday, November 16, 2014 1:52 PM

All replies

  • Can you post a repro project to show more information?
    Monday, November 17, 2014 3:11 PM