improve exception handling

Description

As per SYNR-1113, there are two areas in the Python client where exception handling could be better:

(1) Exception chaining: When raising a caught exception, be sure to do so with the 'except' block that caught it to utilize Python's exception chaining. See https://stackoverflow.com/questions/16414744/python-exception-chaining

(2) When retrying on exception, do so selectively. In _downloadFileHandle() there is a try/except which retries download on every exception thrown. In there was an exception which was not retryable. Retrying caused another problem to occur which masked the root cause. It would be helpful not to retry 'permanent failures' but rather to simply raise such exceptions.

Environment

None

Activity

Show:
Bruce Hoff
July 10, 2017, 8:55 PM

This pull request shows the correction for (1):
https://github.com/Sage-Bionetworks/synapsePythonClient/pull/432

Ziming Dong
November 2, 2017, 8:32 PM

I'm cherry-picking this into the py-1.7.3 release in addition to working on so we can properly log errors that users will experience.

Ziming Dong
December 1, 2017, 8:17 PM

Since Bruce was the one who made the pull request, I've corrected the assignee to him

Ziming Dong
December 4, 2017, 11:33 PM

Verified that the tracebacks are being included

Assignee

Bruce Hoff

Reporter

Bruce Hoff

Labels

None

Validator

Ziming Dong

Development Area

None

Release Version History

None

Fix versions

Priority

Major
Configure