2019-09-19 16:35:31 +00:00
|
|
|
( function ( track, config, trackSubscribe, user ) {
|
2019-07-16 21:41:37 +00:00
|
|
|
module.exports = function () {
|
2019-09-19 16:35:31 +00:00
|
|
|
var suffix = user.isAnon() ? '.anon' : '.loggedin',
|
|
|
|
COUNTER_NAME = 'counter.MediaWiki.minerva.WebClientError' + suffix;
|
|
|
|
|
2018-08-24 00:34:37 +00:00
|
|
|
/**
|
2019-09-19 16:35:31 +00:00
|
|
|
* Count javascript error
|
2018-08-24 00:34:37 +00:00
|
|
|
*/
|
2019-09-19 16:35:31 +00:00
|
|
|
function countError() {
|
|
|
|
track( COUNTER_NAME, 1 );
|
|
|
|
}
|
2019-02-11 18:11:16 +00:00
|
|
|
|
2019-09-19 16:35:31 +00:00
|
|
|
if ( config.get( 'wgMinervaCountErrors' ) ) {
|
|
|
|
// track RL exceptions
|
|
|
|
trackSubscribe( 'resourceloader.exception', countError );
|
|
|
|
// setup the global error handler
|
|
|
|
trackSubscribe( 'global.error', countError );
|
2018-08-24 00:34:37 +00:00
|
|
|
}
|
2019-07-16 21:41:37 +00:00
|
|
|
};
|
2018-09-13 15:33:20 +00:00
|
|
|
}(
|
|
|
|
mw.track,
|
|
|
|
mw.config,
|
|
|
|
mw.trackSubscribe,
|
2019-09-19 16:35:31 +00:00
|
|
|
mw.user
|
2018-09-13 15:33:20 +00:00
|
|
|
) );
|