diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index d44c2c59..dc6a6d76 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ - Fix: default attribute type changed from 'string' to 'Text' (#664) +- Add: log and return device/group information when DeviceNotFound and GroupNotFound errors (iotagent-json#815) diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 38d2490a..3c6c930d 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -55,8 +55,16 @@ function getEffectiveApiKey(service, subservice, device, callback) { config.getLogger().debug('Using default API Key: %s', config.getConfig().defaultKey); callback(null, config.getConfig().defaultKey); } else { - config.getLogger().error(context, 'COMMANDS-002: Could not find any API Key information for device.'); - callback(new errors.GroupNotFound(service, subservice)); + config + .getLogger() + .error( + context, + 'COMMANDS-002: Could not find any APIKey information for devicein service %s subservice %s and type %s', + service, + subservice, + type + ); + callback(new errors.GroupNotFound(service, subservice, type)); } }); } @@ -86,7 +94,7 @@ function retrieveDevice(deviceId, apiKey, callback) { deviceId ); - callback(new errors.DeviceNotFound(deviceId)); + callback(new errors.DeviceNotFound(deviceId, { apikey: apiKey })); } }); } else {