From fbc71f5138f12d058d1023e5c534da76148a2d9a Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Sat, 1 Dec 2018 22:25:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=B2=D0=B0?= =?UTF-8?q?=D1=82=20=D0=BD=D0=B5=D0=BE=D0=B6=D0=B8=D0=B4=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.js b/index.js index 1f1495a..fe7a3eb 100644 --- a/index.js +++ b/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 {