You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
547 B
25 lines
547 B
import Vue from 'vue'
|
|
import { ErrorLogModule } from '@/store/modules/error-log'
|
|
import { isArray } from '@/utils/validate'
|
|
import settings from '@/settings'
|
|
|
|
const { errorLog: needErrorLog } = settings
|
|
|
|
const checkNeed = () => {
|
|
const env = process.env.NODE_ENV
|
|
if (isArray(needErrorLog) && env) {
|
|
return needErrorLog.includes(env)
|
|
}
|
|
return false
|
|
}
|
|
|
|
if (checkNeed()) {
|
|
Vue.config.errorHandler = function(err, vm, info) {
|
|
ErrorLogModule.AddErrorLog({
|
|
err,
|
|
vm,
|
|
info,
|
|
url: window.location.href
|
|
})
|
|
}
|
|
}
|
|
|