Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 1x 1x 1x 1x 1x | import { getFlag, setFlag, slientConsoleScope } from '../utils/index'
import { EVENTTYPES } from '../common/constant'
import { VueInstance, ViewModel } from './types'
import { handleVueError } from './helper'
import { Severity } from '../utils/Severity'
const hasConsole = typeof console !== 'undefined'
export const MitoVue = {
install(Vue: VueInstance): void {
if (getFlag(EVENTTYPES.VUE) || !Vue || !Vue.config) return
setFlag(EVENTTYPES.VUE, true)
// vue 提供 warnHandler errorHandler报错信息
Vue.config.errorHandler = function (err: Error, vm: ViewModel, info: string): void {
handleVueError.apply(null, [err, vm, info, Severity.Normal, Severity.Error, Vue])
if (hasConsole && !Vue.config.silent) {
slientConsoleScope(() => {
console.error('Error in ' + info + ': "' + err.toString() + '"', vm)
console.error(err)
})
}
}
}
}
|