import config from '../config'
import { warn } from './debug'
import { inBrowser } from './env'

// 这个方法先调用用户配置的 erroHandler 方法输出, 如果没有配置, 在开发测试环境调用warn输出, 在非浏览器环境用 throw抛出错误 export
function handleError (err, vm, info) { if (config.errorHandler) { config.errorHandler.call(null, err, vm, info) } else { if (process.env.NODE_ENV !== 'production') { warn(`Error in ${info}:`, vm) } /* istanbul ignore else */ if (inBrowser && typeof console !== 'undefined') { console.error(err) } else { throw err } } }

 

相关文章:

  • 2021-09-12
  • 2021-11-28
  • 2021-07-21
  • 2022-02-08
  • 2022-03-08
  • 2021-10-10
  • 2021-11-06
  • 2022-01-14
猜你喜欢
  • 2021-12-19
  • 2021-10-23
  • 2021-11-03
  • 2021-11-04
  • 2021-08-30
  • 2021-11-16
  • 2021-10-12
相关资源
相似解决方案