监听所有未捕获错误事件并记录到日志中
parent
a50ecff189
commit
c81171a39e
|
@ -0,0 +1,12 @@
|
|||
const { log } = require('./utils')
|
||||
|
||||
process.on('uncaughtException', function(err) {
|
||||
console.error('An uncaught error occurred!')
|
||||
console.error(err)
|
||||
log.error(err)
|
||||
})
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
console.error('Unhandled Rejection at: Promise ', p)
|
||||
console.error(' reason: ', reason)
|
||||
log.error(reason)
|
||||
})
|
|
@ -15,6 +15,7 @@ app.on('second-instance', (event, argv, cwd) => {
|
|||
}
|
||||
})
|
||||
|
||||
require('../common/error')
|
||||
require('./events')
|
||||
const autoUpdate = require('./utils/autoUpdate')
|
||||
const { isLinux, isMac } = require('../common/utils')
|
||||
|
|
|
@ -11,6 +11,8 @@ import App from './App'
|
|||
import router from './route'
|
||||
import store from './store'
|
||||
|
||||
import '../common/error'
|
||||
|
||||
sync(store, router)
|
||||
|
||||
if (!process.env.IS_WEB) {
|
||||
|
|
Loading…
Reference in New Issue