Skip to content

Commit

Permalink
improve exception error messages for downloading (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylion007 authored Dec 11, 2023
1 parent 8b0f1df commit 4bcdf72
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions streaming/base/storage/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ def download_from_azure(remote: str, local: str) -> None:
with open(local, 'wb') as my_blob:
blob_data = blob_client.download_blob()
blob_data.readinto(my_blob)
except ResourceNotFoundError:
raise FileNotFoundError(f'Object {remote} not found.')
except ResourceNotFoundError as e:
raise FileNotFoundError(f'Object {remote} not found.') from e
except Exception:
raise

Expand Down Expand Up @@ -327,8 +327,8 @@ def download_from_azure_datalake(remote: str, local: str) -> None:
with open(local, 'wb') as my_file:
file_data = file_client.download_file()
file_data.readinto(my_file)
except ResourceNotFoundError:
raise FileNotFoundError(f'Object {remote} not found.')
except ResourceNotFoundError as e:
raise FileNotFoundError(f'Object {remote} not found.') from e
except Exception:
raise

Expand Down Expand Up @@ -373,7 +373,7 @@ def download_from_databricks_unity_catalog(remote: str, local: str) -> None:
f'operations. Increase the `download_retry` value to retry downloading ' +
f'a file.',)
if e.error_code == 'NOT_FOUND':
raise FileNotFoundError(f'Object dbfs:{remote} not found.')
raise FileNotFoundError(f'Object dbfs:{remote} not found.') from e
raise e
os.rename(local_tmp, local)

Expand Down

0 comments on commit 4bcdf72

Please sign in to comment.