Island: Change FileNotFoundError import in LocalStorageFileRepository

This commit is contained in:
Mike Salvatore 2022-07-02 09:38:28 -04:00
parent 48ccf467e0
commit c00249fc17
1 changed files with 3 additions and 2 deletions

View File

@ -4,10 +4,11 @@ from pathlib import Path
from typing import BinaryIO from typing import BinaryIO
from common.utils.file_utils import get_all_regular_files_in_directory from common.utils.file_utils import get_all_regular_files_in_directory
from monkey_island.cc import repository
from monkey_island.cc.repository import RemovalError, RetrievalError, StorageError from monkey_island.cc.repository import RemovalError, RetrievalError, StorageError
from monkey_island.cc.server_utils.file_utils import create_secure_directory from monkey_island.cc.server_utils.file_utils import create_secure_directory
from . import IFileRepository, i_file_repository from . import IFileRepository
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -49,7 +50,7 @@ class LocalStorageFileRepository(IFileRepository):
return open(safe_file_path, "rb") return open(safe_file_path, "rb")
except FileNotFoundError as err: except FileNotFoundError as err:
# Wrap Python's FileNotFound error, which is-an OSError, in repository.FileNotFoundError # Wrap Python's FileNotFound error, which is-an OSError, in repository.FileNotFoundError
raise i_file_repository.FileNotFoundError( raise repository.FileNotFoundError(
f'The requested file "{unsafe_file_name}" does not exist: {err}' f'The requested file "{unsafe_file_name}" does not exist: {err}'
) )
except Exception as err: except Exception as err: