Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include device info in errors #668

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading