mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Using specific errors to refuse file refresh.
This commit is contained in:
parent
831bfb98a2
commit
8ba5b63221
1 changed files with 3 additions and 1 deletions
|
|
@ -431,9 +431,11 @@ async def refresh_discover_paths(paths: List[pathlib.Path], idempotency: datetim
|
|||
Will refuse to refresh when the media directory is empty."""
|
||||
try:
|
||||
next(get_media_directory().iterdir())
|
||||
except:
|
||||
except StopIteration:
|
||||
# We don't want to delete a bunch of files which would exist if the drive was mounted.
|
||||
raise UnknownDirectory(f'Refusing to refresh because media directory is empty or does not exist.')
|
||||
except FileNotFoundError:
|
||||
raise UnknownDirectory(f'Refusing to refresh because media directory is empty or does not exist.')
|
||||
|
||||
if not paths:
|
||||
raise ValueError('Must provide some paths to refresh.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue