Sage-Bionetworks / synapsePythonClient

Programmatic interface to Synapse services for Python
https://www.synapse.org
Apache License 2.0
65 stars 67 forks source link

[SYNPY-1442] Log update to capture exception when download-list fails #1071

Closed BryanFauble closed 4 months ago

BryanFauble commented 4 months ago

Problem:

  1. If an exception was raised during get-download-list we did not print it out anywhere (Exception Swallowing)

Solution:

  1. use .exception on the logger which will capture the exception being raised

Testing:

  1. Verified functionality in a unit test
  2. Also verified by manually placing temporary code in .get() that the exception is logged to console:
    Downloading  [####################]100.00%   418.0bytes/418.0bytes (227.4kB/s) manifest.csv Done...
    [ERROR] Unable to download file
    Traceback (most recent call last):
    File "/home/bfauble/BryansGreatWorkspace/synapsePythonClient/synapseclient/client.py", line 2195, in get_download_list
    entity = self.get(row["ID"], downloadLocation=downloadLocation)
    File "/home/bfauble/.pyenv/versions/3.8.18/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
    File "/home/bfauble/BryansGreatWorkspace/synapsePythonClient/synapseclient/client.py", line 1098, in get
    raise SynapseError("This is a test error")
    synapseclient.core.exceptions.SynapseError: This is a test error
    [WARNING] A manifest was created, but no files were downloaded
    Manifest file: manifest_1708712431265684147.csv
sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud