Skip to content

Commit

Permalink
add error info to doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
FuHsinyu committed Aug 30, 2024
1 parent b44e1f4 commit 0c28a0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions troubleshoot_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def get_md5_remote_ssh(ctx, host, username, file_path):
log.write(ctx, "Error: {}".format(stderr))
return None
except Exception as e:
log.write("An error occurred: {}".format(str(e)))
log.write(ctx, "An error occurred: {}".format(str(e)))
return None


Expand All @@ -198,12 +198,14 @@ def get_attribute_value(ctx, data_package, attribute_suffix):
:param attribute_suffix: Suffix of the attribute before adding prefix such as "org_publication_"
:returns: Value of the attribute.
:raises ValueError: If the attribute is not found in the data package's AVU.
"""

attr = constants.UUORGMETADATAPREFIX + "publication_" + attribute_suffix
try:
return next(m.value for m in avu.of_coll(ctx, data_package) if m.attr == attr)
except StopIteration:
except Exception:
raise ValueError("Attribute {} not found in AVU".format(attr))


Expand Down

0 comments on commit 0c28a0f

Please sign in to comment.