From: Christian Heller Date: Sun, 24 Nov 2024 17:27:37 +0000 (+0100) Subject: Remove exception type not used for any actual differentiation. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/day_todos?a=commitdiff_plain;h=fafd2e95a262905b74473823aa1a444ec3709e55;p=ytplom Remove exception type not used for any actual differentiation. --- diff --git a/ytplom/misc.py b/ytplom/misc.py index 0928fbe..9c893bd 100644 --- a/ytplom/misc.py +++ b/ytplom/misc.py @@ -130,10 +130,6 @@ class NotFoundException(Exception): """Raise on expected data missing, e.g. DB fetches finding nothing.""" -class CantWriteException(Exception): - """Raise when there's an obstacle to expected writing of data.""" - - class HandledException(Exception): """Raise in any other case where we know what's happening.""" @@ -143,8 +139,8 @@ def _ensure_expected_dirs(expected_dirs: list[PathStr]) -> None: for dir_name in expected_dirs: if not isdir(dir_name): if path_exists(dir_name): - raise CantWriteException('at expected directory path ' - f'{dir_name} found non-directory') + raise HandledException(f'at expected directory path {dir_name}' + 'found non-directory') print(f'creating expected directory: {dir_name}') makedirs(dir_name) @@ -156,8 +152,8 @@ class DatabaseConnection: self._path = path if not isfile(self._path): if path_exists(self._path): - raise CantWriteException(f'no DB at {self._path}; would create' - ', but something\'s already there?') + raise HandledException(f'no DB at {self._path}; would create, ' + 'but something\'s already there?') path_db_dir = dirname(self._path) if not isdir(path_db_dir): raise NotFoundException(