diff --git a/tests/test_gdc.py b/tests/test_gdc.py index 155186b..4a89b8f 100644 --- a/tests/test_gdc.py +++ b/tests/test_gdc.py @@ -69,6 +69,11 @@ def test_download(): os.unlink(file_path) +def test_download_error(): + uuid = "something-invalid-0101" + gdc.download(uuid) + + def test_get_project_info(): project_name = "TCGA-THCA" assert 'TCGA-BRCA' in gdc.get_project_info().index @@ -88,3 +93,6 @@ def test_get_samples_clinical(): project_id = "TCGA-OV" actual = gdc.get_samples_clinical(project_id) assert actual['case_id'][0] == "71faa2c1-0d5b-4dcc-bdf9-f2405f29907c" + + +test_download_error() \ No newline at end of file diff --git a/xena_gdc_etl/gdc.py b/xena_gdc_etl/gdc.py index 97b49dd..964d40d 100644 --- a/xena_gdc_etl/gdc.py +++ b/xena_gdc_etl/gdc.py @@ -348,7 +348,9 @@ def download(uuids, download_dir='.', chunk_size=4096): sys.stdout.flush() download_list.append(path) else: - print('\rFail to download file {}.'.format(uuid)) + print('\rFailed to download file {filename}.' + 'Error code: {errcode}'.format(filename=uuid, + errcode=response.status_code)) print('') return download_list