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