Skip to content

Commit ff41339

Browse files
committed
Improve error output if failed list_resources
1 parent 004d402 commit ff41339

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

blackduck/Client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ def list_resources(self, parent=None):
142142
try:
143143
rel_href_pairs = iter(obj)
144144
except TypeError:
145-
logger.error("not iterable obj:")
146-
pprint(obj)
145+
logger.error("unable to list resources on parent object (missing ['_meta']['links']):")
146+
pprint(parent)
147147
raise
148148
resources_dict = {}
149149
for res in rel_href_pairs:
150150
resources_dict[res['rel']] = res['href']
151-
resources_dict['href'] = safe_get(parent, '_meta', 'href') # save url to parent itself
151+
# save url to parent itself if available, otherwise save 'href': None
152+
resources_dict['href'] = safe_get(parent, '_meta', 'href')
152153
parent[key] = resources_dict # cache for future use
153154
return parent[key]
154155

0 commit comments

Comments
 (0)