Skip to content

Commit

Permalink
Handles S3 listing errors
Browse files Browse the repository at this point in the history
Adds exception handling for S3 bucket listing to provide clearer error messages when listing fails.
  • Loading branch information
itisAliRH committed Jan 22, 2025
1 parent 42f190e commit 6718c01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/galaxy/files/sources/s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Unpack,
)

from galaxy import exceptions
from galaxy.files import OptionalUserContext
from . import (
AnyRemoteEntry,
Expand Down Expand Up @@ -93,7 +94,10 @@ def _list(
return res, len(res)
else:
bucket_path = self._bucket_path(_bucket_name, path)
res = fs.ls(bucket_path, detail=True)
try:
res = fs.ls(bucket_path, detail=True)
except Exception as e:
raise exceptions.MessageException(f"Error listing {bucket_path}: {e}")
to_dict = functools.partial(self._resource_info_to_dict, path)
return list(map(to_dict, res)), len(res)

Expand Down

0 comments on commit 6718c01

Please sign in to comment.