Skip to content

Commit bdfb08b

Browse files
committed
🥅 Exit gracefully when inspect fails during download
1 parent 7adc822 commit bdfb08b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

icenet_mp/data_processors/data_downloader.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import shutil
33
from pathlib import Path
44

5+
import typer
56
from anemoi.datasets.commands.finalise import Finalise
67
from anemoi.datasets.commands.init import Init
78
from anemoi.datasets.commands.inspect import InspectZarr
@@ -69,13 +70,13 @@ def create(self, *, overwrite: bool) -> None:
6970
self.path_dataset,
7071
)
7172
except (AttributeError, FileNotFoundError, PathNotFoundError):
72-
# If the dataset is invalid we delete it
73-
logger.info(
74-
"Dataset %s at %s is invalid, removing it.",
73+
# If the dataset is invalid we flag this to the user and exit
74+
logger.error( # noqa: TRY400
75+
"Dataset %s at %s seems to be invalid. Please check manually.",
7576
self.name,
7677
self.path_dataset,
7778
)
78-
raise
79+
typer.Exit(1)
7980
else:
8081
# If the dataset is valid we return here
8182
return

0 commit comments

Comments
 (0)