From 352abb3f608822a704ec58299691efb9532eb764 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 23 Jun 2022 13:52:27 +0300 Subject: [PATCH] JS-executor: Fixed incorrect parse error code for message --- msa/js-executor/api/jsInvokeMessageProcessor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/msa/js-executor/api/jsInvokeMessageProcessor.js b/msa/js-executor/api/jsInvokeMessageProcessor.js index f0ed4c274c..86f441a5b3 100644 --- a/msa/js-executor/api/jsInvokeMessageProcessor.js +++ b/msa/js-executor/api/jsInvokeMessageProcessor.js @@ -144,7 +144,7 @@ JsInvokeMessageProcessor.prototype.processInvokeRequest = function (requestId, r }, (err) => { var errorCode; - if (err.message.includes('Script execution timed out')) { + if (err && isString(err.message) && err.message.includes('Script execution timed out')) { errorCode = TIMEOUT_ERROR; } else { errorCode = RUNTIME_ERROR; @@ -321,4 +321,8 @@ function deleteMinUsedScript() { this.scriptMap.delete(prevScriptId); } +function isString(value) { + return typeof value === 'string'; +} + module.exports = JsInvokeMessageProcessor;