Skip to content

Commit

Permalink
Address review concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Aug 20, 2024
1 parent 5a7590f commit 51a1a93
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions tosfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def rmdir(self, path: str) -> None:
----------
path : str
The path of the directory to remove. The path should be in the format
`tos://bucket_name/directory_path`.
`tos://bucket/path/to/directory`.
Raises
------
Expand All @@ -231,7 +231,6 @@ def rmdir(self, path: str) -> None:
path = self._strip_protocol(path).rstrip("/") + "/"
bucket, key, _ = self._split_path(path)
if not key:
logger.error("Cannot remove a bucket using rmdir api.")
raise TosfsError("Cannot remove a bucket using rmdir api.")

if not self.exists(path):
Expand All @@ -247,13 +246,10 @@ def rmdir(self, path: str) -> None:
self.tos_client.delete_object(bucket, key.rstrip("/") + "/")
self.invalidate_cache(path.rstrip("/"))
except tos.exceptions.TosClientError as e:
logger.error("Tosfs failed with client error: %s", e)
raise e
except tos.exceptions.TosServerError as e:
logger.error("Tosfs failed with server error: %s", e)
raise e
except Exception as e:
logger.error("Tosfs failed with unknown error: %s", e)
raise TosfsError(f"Tosfs failed with unknown error: {e}") from e

def _info_from_cache(
Expand Down

0 comments on commit 51a1a93

Please sign in to comment.