From 4c1a787b12708a61c7e30e3f6ec58a4e10d9bea6 Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Tue, 5 Feb 2019 18:20:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87?= =?UTF-8?q?=D0=B8=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BE=D0=BA=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D1=91=D0=BD=D0=BD=D0=BE=D0=BC=D1=83=20=D1=81=D0=B5=D1=80?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/out_queue_processor.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/core/out_queue_processor.js b/core/out_queue_processor.js index e0bc283..d9d6f76 100644 --- a/core/out_queue_processor.js +++ b/core/out_queue_processor.js @@ -24,6 +24,7 @@ const { SERR_APP_SERVER_BEFORE, SERR_APP_SERVER_AFTER, SERR_DB_SERVER, + SERR_WEB_SERVER, SERR_UNAUTH } = require("./constants"); //Глобальные константы const { @@ -205,14 +206,20 @@ const appProcess = async prms => { nQueueId: prms.queue.nId }); //Отправляем сообщение удалённому серверу - let serverResp = await rqp(options); - //Сохраняем полученный ответ - prms.queue.blResp = new Buffer(serverResp); - await dbConn.setQueueResp({ - nQueueId: prms.queue.nId, - blResp: prms.queue.blResp, - nIsOriginal: NIS_ORIGINAL_YES - }); + try { + //Ждем ответ от удалённого сервера + let serverResp = await rqp(options); + //Сохраняем полученный ответ + prms.queue.blResp = new Buffer(serverResp || ""); + await dbConn.setQueueResp({ + nQueueId: prms.queue.nId, + blResp: prms.queue.blResp, + nIsOriginal: NIS_ORIGINAL_YES + }); + } catch (e) { + //Прекращаем исполнение если были ошибки + throw new ServerError(SERR_WEB_SERVER, `${e.response.statusCode} - ${e.response.statusMessage}`); + } //Выполняем обработчик "После" (если он есть) if (prms.function.sAppSrvAfter) { const fnAfter = getAppSrvFunction(prms.function.sAppSrvAfter);