From 3c2ee32bdfba2402c52325990eb7c851497ed982 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 28 Sep 2022 12:21:41 -0400 Subject: [PATCH] Island: Add RepositoryError --- monkey/monkey_island/cc/repository/__init__.py | 2 +- monkey/monkey_island/cc/repository/errors.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/repository/__init__.py b/monkey/monkey_island/cc/repository/__init__.py index 91d6bed30..9012afb8b 100644 --- a/monkey/monkey_island/cc/repository/__init__.py +++ b/monkey/monkey_island/cc/repository/__init__.py @@ -1,4 +1,4 @@ -from .errors import RemovalError, RetrievalError, StorageError, UnknownRecordError +from .errors import RemovalError, RepositoryError, RetrievalError, StorageError, UnknownRecordError from .i_file_repository import FileNotFoundError, IFileRepository diff --git a/monkey/monkey_island/cc/repository/errors.py b/monkey/monkey_island/cc/repository/errors.py index a5c26fe15..f01114cc0 100644 --- a/monkey/monkey_island/cc/repository/errors.py +++ b/monkey/monkey_island/cc/repository/errors.py @@ -1,22 +1,28 @@ -class RemovalError(RuntimeError): +class RepositoryError(RuntimeError): + """ + Raised when a repository encounters an error while attempting any operation. + """ + + +class RemovalError(RepositoryError): """ Raised when a repository encounters an error while attempting to remove data. """ -class RetrievalError(RuntimeError): +class RetrievalError(RepositoryError): """ Raised when a repository encounters an error while attempting to retrieve data. """ -class StorageError(RuntimeError): +class StorageError(RepositoryError): """ Raised when a repository encounters an error while attempting to store data. """ -class UnknownRecordError(RuntimeError): +class UnknownRecordError(RepositoryError): """ Raised when the repository does not contain any data matching the request. """