Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 40157de

Browse files
committed
feat(samples): differentiate between Exception and UserWarning in download_many snippet
1 parent d09c408 commit 40157de

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

samples/snippets/storage_transfer_manager_download_many.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ def download_many_blobs_with_transfer_manager(
7373
for name, result in zip(blob_names, results):
7474
# The results list is either `None`, an exception, or a warning for each blob in
7575
# the input list, in order.
76-
77-
if isinstance(result, Exception):
78-
print("Failed to download {} due to exception: {}".format(name, result))
79-
elif isinstance(result, Warning):
76+
if isinstance(result, UserWarning):
8077
print("Skipped download for {} due to warning: {}".format(name, result))
78+
elif isinstance(result, Exception):
79+
print("Failed to download {} due to exception: {}".format(name, result))
8180
else:
8281
print("Downloaded {} inside {} directory.".format(name, destination_directory))
8382
# [END storage_transfer_manager_download_many]

0 commit comments

Comments
 (0)