*/
loader: ( function () {
+ /**
+ * Fired via mw.track on various resource loading errors.
+ *
+ * @event resourceloader_exception
+ * @param {Error|Mixed} e The error that was thrown. Almost always an Error
+ * object, but in theory module code could manually throw something else, and that
+ * might also end up here.
+ * @param {string} [module] Name of the module which caused the error. Omitted if the
+ * error is not module-related or the module cannot be easily identified due to
+ * batched handling.
+ * @param {string} source Source of the error. Possible values:
+ * - style: stylesheet error (only affects old IE where a special style loading method
+ * is used)
+ * - load-callback: exception thrown by user callback
+ * - module-execute: exception thrown by module code
+ */
+
/**
* Mapping of registered modules.
*
styleEl.styleSheet.cssText += cssText;
} catch ( e ) {
log( 'Stylesheet error', e );
+ mw.track( 'resourceloader.exception', { exception: e, source: 'stylesheet' } );
}
} else {
styleEl.appendChild( document.createTextNode( cssText ) );
// A user-defined callback raised an exception.
// Swallow it to protect our state machine!
log( 'Exception thrown by user callback', e );
+ mw.track( 'resourceloader.exception',
+ { exception: e, module: module, source: 'load-callback' } );
}
}
}
// and not in debug mode, such as when a symbol that should be global isn't exported
log( 'Exception thrown by ' + module, e );
registry[module].state = 'error';
+ mw.track( 'resourceloader.exception', { exception: e, module: module, source: 'module-execute' } );
handlePending( module );
}
}