home · contact · privacy
Remove exception type not used for any actual differentiation.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 24 Nov 2024 17:27:37 +0000 (18:27 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 24 Nov 2024 17:27:37 +0000 (18:27 +0100)
ytplom/misc.py

index 0928fbecd1a0a7f67d5ea0a351269f194f323224..9c893bd5750ad52c0718c79f397b65ddd51293da 100644 (file)
@@ -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(