|
|
@@ -40,28 +40,31 @@ let onModsReady = function () { |
|
|
|
components.init(onCpnsReady); |
|
|
|
}; |
|
|
|
|
|
|
|
let onDbReady = function () { |
|
|
|
require('../misc/random'); |
|
|
|
const onCrash = async e => { |
|
|
|
if (e.toString().indexOf('ERR_IPC_CHANNEL_CLOSED') > -1) |
|
|
|
return; |
|
|
|
|
|
|
|
mods.init(onModsReady); |
|
|
|
_.log('Error Logged: ' + e.toString()); |
|
|
|
_.log(e.stack); |
|
|
|
|
|
|
|
process.on('uncaughtException', async function (e) { |
|
|
|
if (e.toString().indexOf('ERR_IPC_CHANNEL_CLOSED') > -1) |
|
|
|
return; |
|
|
|
await io.setAsync({ |
|
|
|
key: new Date(), |
|
|
|
table: 'error', |
|
|
|
value: e.toString() + ' | ' + e.stack.toString() |
|
|
|
}); |
|
|
|
|
|
|
|
process.send({ |
|
|
|
event: 'onCrashed' |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
_.log('Error Logged: ' + e.toString()); |
|
|
|
_.log(e.stack); |
|
|
|
let onDbReady = function () { |
|
|
|
require('../misc/random'); |
|
|
|
|
|
|
|
await io.setAsync({ |
|
|
|
key: new Date(), |
|
|
|
table: 'error', |
|
|
|
value: e.toString() + ' | ' + e.stack.toString() |
|
|
|
}); |
|
|
|
mods.init(onModsReady); |
|
|
|
|
|
|
|
process.send({ |
|
|
|
event: 'onCrashed' |
|
|
|
}); |
|
|
|
}); |
|
|
|
process.on('uncaughtException', onCrash); |
|
|
|
process.on('unhandledRejection', onCrash); |
|
|
|
}; |
|
|
|
|
|
|
|
io.init(onDbReady); |
|
|
|