Skip to content

Commit 92a1122

Browse files
authored
Merge pull request #816 from telefonicaid/task/add_typeInformation_in_errors
Include device info in errors
2 parents e0d9fa0 + a193426 commit 92a1122

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGES_NEXT_RELEASE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
- Fix: default attribute type changed from 'string' to 'Text' (#810)
2+
- Add: log and return device/group information when DeviceNotFound and GroupNotFound errors (#815)

lib/iotaUtils.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,16 @@ function getEffectiveApiKey(service, subservice, device, callback) {
5555
config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey);
5656
callback(null, config.getConfig().defaultKey);
5757
} else {
58-
config.getLogger().error(context, 'Could not find any API Key information for device.');
59-
callback(new errors.GroupNotFound(service, subservice));
58+
config
59+
.getLogger()
60+
.error(
61+
context,
62+
'Could not find any APIKey information for device in service %s subservice %s and type %s',
63+
service,
64+
subservice,
65+
type
66+
);
67+
callback(new errors.GroupNotFound(service, subservice, type));
6068
}
6169
});
6270
}
@@ -163,7 +171,7 @@ function retrieveDevice(deviceId, apiKey, callback) {
163171
deviceId
164172
);
165173

166-
callback(new errors.DeviceNotFound(deviceId));
174+
callback(new errors.DeviceNotFound(deviceId, { apikey: apiKey }));
167175
}
168176
});
169177
} else {

0 commit comments

Comments
 (0)