aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/vue/errorLogger.js
blob: 051f1c37a3a755074657cd17c899d5d64a2a7fdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*!
 * Plugin that captures errors from Vue code and logs them to mw.errorLogger
 */
module.exports = {
	install: function ( app ) {
		/**
		 * Track component errors that bubble up to the Vue.js runtime on the `error.vue` analytics
		 * event topic for one or more subscribers to send to an error logging service. Also log those
		 * errors to the console, which is the default behaviour of the Vue.js runtime.
		 *
		 * See also <https://phabricator.wikimedia.org/T249826>.
		 *
		 * @ignore
		 * @param {Error} error
		 */
		app.config.errorHandler = function ( error ) {
			mw.errorLogger.logError( error, 'error.vue' );

			mw.log.error( error );
		};
	}
};