"""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."""
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)
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(