mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/lyswhut/lx-music-desktop.git
synced 2026-09-20 08:04:00 +08:00
监听所有未捕获错误事件并记录到日志中
This commit is contained in:
12
src/common/error.js
Normal file
12
src/common/error.js
Normal file
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user