Skip to content

Commit

Permalink
Communicate create() error to user
Browse files Browse the repository at this point in the history
This is still not optimal, as it would say things like:

    create(error): . (dataset) [will not create a dataset
    in a non-empty directory, use `--force` option to ignore]

without exposing the necessary options to act on this advice.
But at least it gives a clue what has failed.

Closes #45
  • Loading branch information
mih committed Jan 25, 2023
1 parent 33c5dc3 commit 7ddd593
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion datalad_ebrains/fairgraph_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from fairgraph import KGClient
import fairgraph.openminds.core as omcore

from datalad_next.exceptions import IncompleteResultsError
from datalad_next.datasets import Dataset
from datalad_next.utils import log_progress

Expand All @@ -31,7 +32,12 @@ def bootstrap(self, from_id: str, dl_ds: Dataset):
kg_ds = self.get_dataset_from_id(from_id)
# create datalad dataset
# TODO support existing datasets
ds = self.create_ds(dl_ds, kg_ds)
try:
ds = self.create_ds(dl_ds, kg_ds)
except IncompleteResultsError as e:
# make sure to communicate the error outside
yield from e.failed
return
# robust handling of single-version datasets
kg_dsversions = kg_ds.versions \
if isinstance(kg_ds.versions, list) else [kg_ds.versions]
Expand Down

0 comments on commit 7ddd593

Please sign in to comment.