Island: Add TODO about IFileRepository FileNotFoundErrors

This commit is contained in:
Mike Salvatore 2022-06-08 10:34:46 -04:00
parent 729497c594
commit 1b2ca74b9f
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,10 @@ class LocalStorageFileRepository(IFileRepository):
logger.debug(f"Opening {safe_file_path}") logger.debug(f"Opening {safe_file_path}")
return open(safe_file_path, "rb") return open(safe_file_path, "rb")
except OSError as err: except OSError as err:
# TODO: The interface should make a destinction between file not found and an error when
# retrieving a file that should exist. The built-in `FileNotFoundError` is not
# sufficient because it inherits from `OSError` and the interface does not
# guarantee that the file is stored on the local file system.
raise FileRetrievalError(f"Failed to retrieve file {safe_file_path}: {err}") from err raise FileRetrievalError(f"Failed to retrieve file {safe_file_path}: {err}") from err
def delete_file(self, unsafe_file_name: str): def delete_file(self, unsafe_file_name: str):