Skip to content

Commit

Permalink
Merge pull request #668 from telefonicaid/task/add_typeInformation_in…
Browse files Browse the repository at this point in the history
…_errors

Include device info in errors
  • Loading branch information
fgalan authored Feb 22, 2024
2 parents 776a40e + 7cb9c1c commit d618004
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 11 additions & 3 deletions lib/iotaUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
});
}
Expand Down Expand Up @@ -86,7 +94,7 @@ function retrieveDevice(deviceId, apiKey, callback) {
deviceId
);

callback(new errors.DeviceNotFound(deviceId));
callback(new errors.DeviceNotFound(deviceId, { apikey: apiKey }));
}
});
} else {
Expand Down

0 comments on commit d618004

Please sign in to comment.