Перехват неожиданных ошибок
This commit is contained in:
parent
5657b62d15
commit
fbc71f5138
9
index.js
9
index.js
@ -57,6 +57,15 @@ process.on("SIGKILL", () => {
|
||||
appSrv.stop();
|
||||
});
|
||||
|
||||
//Перехват всех неохваченных ошибок
|
||||
process.on("uncaughtException", e => {
|
||||
//Протоколируем ошибку
|
||||
if (e instanceof ServerError) appSrv.logger.error(e.sCode + ": " + e.sMessage);
|
||||
else appSrv.logger.error(SERR_UNEXPECTED + ": " + e.message);
|
||||
//Инициируем выход из процесса
|
||||
appSrv.stop();
|
||||
});
|
||||
|
||||
//Запуск сервера приложений
|
||||
const start = async () => {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user