From e393dbbca70cca514ddb123c24f8d6cb4e34b278 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 5 Mar 2021 09:00:03 +0100 Subject: [PATCH 1/2] fix log about get protocol result --- lib/services/protocolData.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/services/protocolData.js b/lib/services/protocolData.js index fbff0f5..e2aab75 100644 --- a/lib/services/protocolData.js +++ b/lib/services/protocolData.js @@ -87,13 +87,14 @@ function getProtocol(protocol, callback) { }; const query = Protocol.model.find(condition).sort(); - query.exec(function (error, protocol) { - if (!error && protocol && protocol.length === 1) { - callback(null, protocol[0]); + query.exec(function (error, protocolFound) { + if (!error && protocolFound && protocolFound.length === 1) { + callback(null, protocolFound[0]); } else if (error) { callback(error); } else { - callback(new errors.ProtocolNotFound(protocol)); + var resource = 'n/a'; + callback(new errors.ProtocolNotFound(resource, protocol)); } }); } From 77ada79353f3a9a345ccf1e7308a4b4402b50af6 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 5 Mar 2021 09:01:52 +0100 Subject: [PATCH 2/2] use const instead of var --- CHANGES_NEXT_RELEASE | 1 + lib/services/protocolData.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 5764bc7..a999cc6 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +- Fix: log about getProtocol result - Fix: ensure protocol exists before remove it (#234) - Fix: print URI in logs about redirection error (#232) - Upgrade NodeJS version from 10 to 12 in Dockerfile due to Node 10 End-of-Life diff --git a/lib/services/protocolData.js b/lib/services/protocolData.js index e2aab75..ea48802 100644 --- a/lib/services/protocolData.js +++ b/lib/services/protocolData.js @@ -93,7 +93,7 @@ function getProtocol(protocol, callback) { } else if (error) { callback(error); } else { - var resource = 'n/a'; + const resource = 'n/a'; callback(new errors.ProtocolNotFound(resource, protocol)); } });