From b01d2fc44fe515c7c282d5a0c5ec35813fddf123 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 22 Feb 2024 10:30:32 +0100 Subject: [PATCH 1/4] Include device info in errors --- lib/iotaUtils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 4b845736c..389490163 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -55,8 +55,14 @@ function getEffectiveApiKey(service, subservice, device, callback) { config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); callback(null, config.getConfig().defaultKey); } else { - config.getLogger().error(context, 'Could not find any API Key information for device.'); - callback(new errors.GroupNotFound(service, subservice)); + logger.error( + context, + 'Could not find any APIKey information for device in service %s subservice %s and type %s', + service, + subservice, + type + ); + callback(new errors.GroupNotFound(service, subservice, type)); } }); } @@ -163,7 +169,7 @@ function retrieveDevice(deviceId, apiKey, callback) { deviceId ); - callback(new errors.DeviceNotFound(deviceId)); + callback(new errors.DeviceNotFound(deviceId, { apikey: apiKey })); } }); } else { From 7a1f2630395524d09864fdbf43c9089c5ca6e5e8 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 22 Feb 2024 10:43:38 +0100 Subject: [PATCH 2/4] fix log --- lib/iotaUtils.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 389490163..2c05196b8 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -55,13 +55,15 @@ function getEffectiveApiKey(service, subservice, device, callback) { config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); callback(null, config.getConfig().defaultKey); } else { - logger.error( - context, - 'Could not find any APIKey information for device in service %s subservice %s and type %s', - service, - subservice, - type - ); + config + .getLogger() + .error( + context, + 'Could not find any APIKey information for device in service %s subservice %s and type %s', + service, + subservice, + type + ); callback(new errors.GroupNotFound(service, subservice, type)); } }); From 9e780472a7837bdacaf6b86d9e55103772babeb5 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 22 Feb 2024 11:05:29 +0100 Subject: [PATCH 3/4] update CNR --- CHANGES_NEXT_RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index b95c121e5..9c1a172aa 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ - Fix: default attribute type changed from 'string' to 'Text' (#810) +- ADD: Log and return device/group information when DeviceNotFound GroupNotFound errors From a193426161e6d03be429742a127c3d0337165c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 22 Feb 2024 15:45:35 +0100 Subject: [PATCH 4/4] Update CHANGES_NEXT_RELEASE --- CHANGES_NEXT_RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 9c1a172aa..bc98324dc 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,2 +1,2 @@ - Fix: default attribute type changed from 'string' to 'Text' (#810) -- ADD: Log and return device/group information when DeviceNotFound GroupNotFound errors +- Add: log and return device/group information when DeviceNotFound and GroupNotFound errors (#815)