Island: raise RemovalError in Local...FileRepository.delete_all_files()
This commit is contained in:
parent
da1339e410
commit
21be5fc2be
|
@ -56,5 +56,7 @@ class IFileRepository(metaclass=abc.ABCMeta):
|
||||||
def delete_all_files(self):
|
def delete_all_files(self):
|
||||||
"""
|
"""
|
||||||
Delete all files that have been stored using this service.
|
Delete all files that have been stored using this service.
|
||||||
|
|
||||||
|
:raises RemovalError: If an error was encountered while attempting to remove a file
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -82,6 +82,9 @@ class LocalStorageFileRepository(IFileRepository):
|
||||||
return safe_file_path
|
return safe_file_path
|
||||||
|
|
||||||
def delete_all_files(self):
|
def delete_all_files(self):
|
||||||
|
try:
|
||||||
for file in get_all_regular_files_in_directory(self._storage_directory):
|
for file in get_all_regular_files_in_directory(self._storage_directory):
|
||||||
logger.debug(f"Deleting {file}")
|
logger.debug(f"Deleting {file}")
|
||||||
file.unlink()
|
file.unlink()
|
||||||
|
except Exception as err:
|
||||||
|
raise RemovalError(f"Error while attempting to clear the repository: {err}")
|
||||||
|
|
Loading…
Reference in New Issue