Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add information about __cause__ exception in the exception printout
Inspired by datalad/datalad-container#267 Before this change > datalad -l debug download-url shub://datalad/datalad-container:testhelper ... download_url(error): /home/yoh/.tmp/datalad_temp_test_container_files0tvyery_/ (file) [AccessFailedError(Failed to establish a new session 1 times. )] [Failed to establish a new session 1 times. ] [DEBUG ] could not perform all requested actions: IncompleteResultsError(Command did not complete successfully. 1 failed: [{'action': 'download_url', 'error_message': 'Failed to establish a new session 1 times. ', 'exception': Failed to establish a new session 1 times. [download_url.py:__call__:202,base.py:download:533,shub.py:access:50,shub.py:_resolve_url:39,base.py:fetch:643,shub.py:access:50,base.py:access:174,base.py:_fetch:589,http.py:get_downloader_session:633,http.py:get_downloader_session:618,sessions.py:get:602,sessions.py:request:589,sessions.py:send:703,adapters.py:send:517], 'exception_traceback': '[download_url.py:__call__:202,base.py:download:533,shub.py:access:50,shub.py:_resolve_url:39,base.py:fetch:643,shub.py:access:50,base.py:access:174,base.py:_fetch:589,http.py:get_downloader_session:633,http.py:get_downloader_session:618,sessions.py:get:602,sessions.py:request:589,sessions.py:send:703,adapters.py:send:517]', 'message': 'AccessFailedError(Failed to establish a new session 1 times. )', 'path': '/home/yoh/.tmp/datalad_temp_test_container_files0tvyery_/', 'status': 'error', 'type': 'file'}]) so no information about actual problem is provided even in DEBUG output. With this change we get at least full record containing it: [DEBUG ] could not perform all requested actions: IncompleteResultsError(Command did not complete successfully. 1 failed: [{'action': 'download_url', 'error_message': 'Failed to establish a new session 1 times. ', 'exception': Failed to establish a new session 1 times. -caused by- HTTPSConnectionPool(host='singularity-hub.org', port=443): Max retries exceeded with url: /api/container/datalad/datalad-container:testhelper (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)'))) [download_url.py:__call__:202,base.py:download:533,shub.py:access:50,shub.py:_resolve_url:39,base.py:fetch:643,shub.py:access:50,base.py:access:174,base.py:_fetch:589,http.py:get_downloader_session:633,http.py:get_downloader_session:618,sessions.py:get:602,sessions.py:request:589,sessions.py:send:703,adapters.py:send:517], 'exception_traceback': '[download_url.py:__call__:202,base.py:download:533,shub.py:access:50,shub.py:_resolve_url:39,base.py:fetch:643,shub.py:access:50,base.py:access:174,base.py:_fetch:589,http.py:get_downloader_session:633,http.py:get_downloader_session:618,sessions.py:get:602,sessions.py:request:589,sessions.py:send:703,adapters.py:send:517]', 'message': 'AccessFailedError(Failed to establish a new session 1 times. )', 'path': '/home/yoh/.tmp/datalad_temp_test_container_files0tvyery_/', 'status': 'error', 'type': 'file'}])
- Loading branch information